Hi
I'm using change_view(self, request, object_id, extra_context=None)
override on a ModelAdmin object, to display field differently based on
the object entries, and change the fieldset order.
def change_view(self, request, object_id, extra_context=None):
post = Post.objects.get(id=object_id)
# if the post is not html we want to display things
differently
if post.markup != PURE_HTML:
self.fieldsets = (
(None, {
'fields': ('title', 'slug', 'markup',
'category', 'tags', 'content', 'status')
}),
)
else:
self.fieldsets = PostAdmin.fieldsets
I understand that the PostAdmin object is instantiate just one time
and the modification of the fieldset remains, so I have to use an else
clause here which redefine the fieldset every times, but it does not
sounds Django to me, what is the best way to do that ?
Thanks for your help
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---