I am trying to understand some basics in django inheritance - I'm sure it is something trivial, buy I just can't get it.
I've got my CartItemForm(forms.ModelForm) and I override init method to get user from post.request, like that:
def __init__(self, *args, **kwargs):
self.request = kwargs.pop('request', None)
super().__init__(*args, **kwargs)
And it works, but I don't really get why it doesn't work when I inherit init method first:
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.request = kwargs.pop('request', None)
init() got an unexpected keyword argument 'request'
What am I missing here?
forms.ModelFormdoesn't recognize keywordrequestbut in the first case you remove it bypopkwargswill still containrequest.