I am trying to initialize a form attribute for the MyModelAdmin class inside an instance method as follows:
class MyModelAdmin(admin.ModelAdmin):
def queryset(self, request):
MyModelAdmin.form = MyModelForm(request.user)
My goal is to customize the editing form MyModelFormbased on the current session. However, when I try to do this, I still get an error message (shown below). Is this a good place to transfer session data to ModelForm? If so, what could be causing this error?
TypeError at ...
Exception Type: TypeError
Exception value: issubclass () arg 1 must be a class
Exclusion location: /usr/lib/pymodules/python2.6/django/forms/models.py in the new , line 185
source
share