#24541: save_new_objects in ModelFromsets do not handle intitial data
-------------------------------+--------------------------------------
Reporter: codingjoe | Owner: nobody
Type: Uncategorized | Status: new
Component: Forms | Version: master
Severity: Normal | Resolution:
Keywords: modelformset | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by timgraham):
* easy: 1 => 0
Comment:
I had no trouble with this view:
{{{
from django.forms.models import modelformset_factory
def test_view(request):
qs = Poll.objects.none()
PollFormSet = modelformset_factory(Poll, fields='__all__')
if request.method == 'POST':
formset = PollFormSet(request.POST, queryset=qs)
if formset.is_valid():
formset.save()
else:
formset = PollFormSet(queryset=qs, initial=[
{'question': 'initial', 'pub_date': timezone.now()}])
return render(request, 'polls/manage.html', {'formset': formset})
}}}
Can you provide a snippet that demonstrates your problem?
--
Ticket URL: <https://code.djangoproject.com/ticket/24541#comment:3>
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/067.e6d93c939924cffec9c5c70330c0a942%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.