この回答に従って、generic.GenericTabularInline を検証しようとしました。
どこが間違っていますか?
class DesignedPhotoInlineForm(forms.models.ModelForm):
class Meta:
model = DesignedPhoto
fields = ( 'imagefile', )
widgets = { 'imagefile': DesignedPhotoImageFieldWidget
}
class ArtistAdminDesignedPhotoInlineFormSet(generic.BaseGenericInlineFormSet):
def clean(self):
print "heh!" #should print into devserver but does not!
pass
class DesignedPhotoInline(generic.GenericTabularInline):
model = DesignedPhoto
ct_field = 'illustrated_content_type'
ct_fk_field = 'illustrated_object_id'
form = DesignedPhotoInlineForm
formset = ArtistAdminDesignedPhotoInlineFormSet
class ArtistAdmin(admin.ModelAdmin):
fieldsets = (
(
_('Main info'), {
'fields': ( ('name', 'full_name', ), ('on_top', 'show_in_menu', ), 'music_style_text', )
},
),
(
_('Profile and history texts'), {
'fields': ( 'profile_text', 'history_text',),
},
)
)
formfield_overrides = {
TextField: { 'widget': tinymce_widgets.AdminTinyMCE(attrs={'cols': 120, 'rows': 25}) },
}
inlines = [ DesignedPhotoInline, ArtistPublicationsInline, ArtistAudioInline, ArtistVideosInline ]
actions = ['create_cms_page']
def create_cms_page(self, request, queryset):
#omitted
pass
create_cms_page.short_description = _("Create pages for the selected artists")
インラインの検証に関する最初の回答と同じ方法で使用しました。formset の基本クラスを generic.BaseGenericInlineFormSet に変更しました。