#27560: Formset.save() crashes for model with foreign key to concrete base model
-------------------------------------+-------------------------------------
Reporter: Lorenzo Peña | Owner: nobody
Type: Bug | Status: new
Component: Forms | Version: 1.9
Severity: Normal | Resolution:
Keywords: formset | Triage Stage: Accepted
inline_formset |
inline_formsetfactory |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Comment (by Bartosz Grabski):
I've tested this and found two issues with your code in `form_valid`:
{{{
...
detail_formset = DetailModelFormset(self.request.POST) <----
there was a bug in your previous code:
DetailModelFormset()(self.request.POST)
if detail_formset.is_valid(): <--- you were missing formset
validation
detail_instances = detail_formset.save(commit=False)
...
}}}
After fixing that, the code works fine.
--
Ticket URL: <https://code.djangoproject.com/ticket/27560#comment:7>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/066.d663e61002a59de46c80d6b63094d509%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.