Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
13 lines (11 sloc) 493 Bytes
class UserKwargModelFormMixin(object):
"""
Generic model form mixin for popping user out of the kwargs and
attaching it to the instance.
This mixin must precede forms.ModelForm/forms.Form. The form is not
expecting these kwargs to be passed in, so they must be poppped off before
anything else is done.
"""
def __init__(self, *args, **kwargs):
self.user = kwargs.pop("user", None)
super(UserKwargModelFormMixin, self).__init__(*args, **kwargs)
Something went wrong with that request. Please try again.