Tuesday, August 12, 2008

Django 1.0 admin custom inlines


...

class ChangeSetForm(forms.ModelForm):
dosomething = forms.BooleanField(label="Do something")
class Meta:
model = ChangeSet
exclude = ('modified',) # Note: This doesn't work!
fields = ('old_title',) # Note: This doesn't work!

ChangeSetInlineFormSet = inlineformset_factory(
Article, ChangeSet,
form = ChangeSetForm
)

class InlineChangeSet(admin.TabularInline):
model = ChangeSet
form = ChangeSetForm
extra = 0
raw_id_fields = ('editor',)
fields = ('old_title', ) # This works.

...

Completely custom inline (without delete checkbox etc)


coming...

No comments: