On Wednesday, May 18, 2011 11:46:14 PM UTC+1, piker wrote:
>
> I have a modelformset_factory instance displaying beautifully, but not
> saving to the database.
> If anyone can spot any mistake i've made in the code it would be much
> appreciated.(i'm using Django 1.3 by the way).
>
> def warning_entry (request):
> SpeciesFormSet =
> modelformset_factory(Species,fields=('botanical_name',
> 'supply_warning'))
> if request.method == 'POST':
> formset = SpeciesFormSet(request.POST,request.FILES)
> if formset.is_valid():
> formset.save()
> return HttpResponseRedirect('/plants/')
> else:
> formset = SpeciesFormSet()
> return render_to_response ('plant
> warnings.html',locals(),context_instance=RequestContext(request))
Are you sure that the formset is valid? What's the output of formset.errors?
--
DR.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.