Closed omarkhan closed 7 years ago
Thank @omarkhan for the reminder on this PR. Do you have any preference what I shall add to the changelog?
@jrief Answering for @omarkhan since he is not working with us (OpenCraft) on this anymore - no specific preference no - something among the lines of "Allow to use form mixins (like NgFormValidationMixin) with django's built-in AuthenticationForm"?
I'll release this together with PR #260 as version 0.8.5 as soon as I get the OK for it.
Background
I am trying to use django-angular's
NgFormValidationMixin
with django's built-inAuthenticationForm
. This is the code I am using:When using this with django's built-in login view, I get the following error:
I did some digging and it turns out that django's login view passes a
request
argument to the form constructor. This breaks theNgFormBaseMixin
constructor, which expectsdata
as the first positional argument.Proposal
This pull request modifies
NgFormBaseMixin.__init__
andNgModelFormMixin.__init__
to not care about the__init__
signature of the form they are mixin in with. This is accomplished by calling the superclass constructor first, then manipulatingself.data
.