That is weird. I don't see serious errors in your view code. I would look at
request.POST. May be you forgot to include formset.management_form into your
template or something like this...

ps: if you use django 1.3, there is a django.shortcuts.render method that is
looks nicer then render_to_response. In your case
return render(request, 'plantwarnings.html', {'formset': formset})

pps: also I wouldn't use locals() in render_to_response, as you can
occasionally redefine variables from template context processors.



On Thu, May 19, 2011 at 12:53 AM, piker <da...@allnatives.com.au> wrote:

> Thanks Oleg,that worked..its always the last thing that you try, isn't
> it?
> However.. I have it displaying beautifully now but it won't save.I
> can't pick whats wrong with this code that it won't save it.It just
> does nothing.Not even an error.If anyone can spot the mistake 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))
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to