I've tried various methods to achieve this.

I decided against overriding formfield_for_dbfield as it's doesn't get
a copy of the request object and I was hoping to avoid the
thread_locals hack.

I settled on overriding get_form in my ModelAdmin class and tried the
following:

    class PageOptions(admin.ModelAdmin):
        def get_form(self, request, obj=None, **kwargs):
            if request.user.is_superuser:
                self.fieldsets = ((None, {'fields':
('title','name',),}),)
            else:
                self.fieldsets = ((None, {'fields': ('title',),}),)
            return super(PageOptions,self).get_form(request, obj=None,
**kwargs)

When I print fieldsets or declared_fieldsets from within get_form I
get None (or whatever I set as an initial value in PageOptions).

Why doesn't this work and is there a better way to do this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to