title: Django - Overriding get_form to customize admin forms based on request
body: <p>I've tried various methods to achieve this.</p>
  <p>I decided against overriding <code>formfield_for_dbfield</code> as it doesn't get a copy of the request object and I was hoping to avoid the <code>thread_locals</code> hack.</p>
  <p>I settled on overriding <code>get_form</code> in my <code>ModelAdmin</code> class and tried the following:</p>
  <pre><code>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)
  </code></pre>
  <p>When I print <code>fieldsets</code> or <code>declared_fieldsets</code> from within <code>get_form</code> I get <code>None</code> (or whatever I set as an initial value in <code>PageOptions</code>).</p>
  <p>Why doesn't this work and is there a better way to do this?</p>