I would like to be able to access request object in django admins clean()
method. How can I customize this getting the user from a admin validation class to work with django admins modelform
What kind of modification do i need to make to change_view
below
def change_view(self, request, object_id, extra_context=None):
self.form = GroupForm
result = super(GroupsAdmin, self).change_view(request, object_id, extra_context)
return result
so that it calls the constructor below which has the request
argument
class GroupForm(forms.ModelForm):
class Meta:
model = Group
def __init__(self, *args, **kwargs):
self.request = kwargs.pop('request', None)
super(GroupForm, self).__init__(*args, **kwargs)