Форум сайта python.su
Пытаюсь сваять интерфейс добавления картинок к статьям. Есть модель Illustration, в которой поле наследуется от ContentType:
class Illustration(models.Model):
class Meta:
verbose_name_plural = 'иллюстрации'
verbose_name = 'иллюстрация'
verbose_name_addition = 'иллюстрацию'
templates = dict(
map(lambda template: (template.__name__, template),
IllustrationTemplate.__subclasses__())
)
template_name = models.CharField(
max_length = 16,
choices = map(lambda template: (template.__name__, template.verbose_name), templates.values())
)
material_type = models.ForeignKey(ContentType)
material_id = models.PositiveIntegerField()
material = generic.GenericForeignKey('material_type', 'material_id')
title = models.CharField(max_length = 256)
width = models.PositiveSmallIntegerField()
height = models.PositiveSmallIntegerField()
image = models.ImageField(width_field = 'width', height_field = 'height', upload_to = settings.ILLUSTRATIONS_PATH)
illustrations = generic.GenericRelation('Illustration')
ImproperlyConfigured at /admin/
'ArticleAdmin.fieldsets' refers to field ‘illustrations’ that is missing from the form.
Отредактировано (Янв. 26, 2010 15:27:13)
Офлайн