On Feb 18, 2009, at 10:16 AM, Thomas Hill wrote:

> #VIEW
> @login_required
> def manage_roles(request, resource_id):
>     resource = get_object_or_404(Lock, pk=resource_id)
>     if(request.method == "POST"):
>         formset = create_roles_formset(resource, request.POST)
>         if formset.is_valid():
>             for form in formset.forms:
>               #Haven't actually hooked up the templates and success logic yet.
>                 print form.cleaned_data['role']
>                 print form.cleaned_data['user']
>                 print '-'
>     else:
>         formset = create_roles_formset(resource)
>         dictToSend['rolesForm'] = formset
>     dictToSend['resource'] = resource
>     return render_to_response('locks/manage_roles.html', dictToSend,
> context_instance=RequestContext(request))

One thing I am noticing here is that if the formset fails to validate  
you are not putting the formset in the dictToSend to be rendered with  
the error messages. The best way to do this is just simply unindent  
the formset assignment to dictToSend in the non-POST case.

Brian Rosner
http://oebfare.com




--~--~---------~--~----~------------~-------~--~----~
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