You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After debugging, we noticed that the form is saved twice in TurboCreateView.
Relevant source code:
# mixins.pyclassTurboFormModelMixin(TurboFormMixin):
object: Optional[Model]
defform_valid(self, form: forms.Form) ->HttpResponse:
"""If the form is valid, save the associated model."""self.object=form.save()
returnsuper().form_valid(form)
# views.pyclassTurboCreateView(TurboFormModelMixin, CreateView):
...
But the Django CreateView already uses the ModelFormMixin with:
defform_valid(self, form):
"""If the form is valid, save the associated model."""self.object=form.save()
returnsuper().form_valid(form)
After debugging, we noticed that the form is saved twice in
TurboCreateView
.Relevant source code:
But the Django
CreateView
already uses theModelFormMixin
with:The result is that
form.save()
is called twice.I think the fix is:
The text was updated successfully, but these errors were encountered: