Monday, July 23, 2012

Re: Checking if a dynamicallygenerated dropdown has a selected item

Thanks Daniel :) Was just poring over the Formsets documentation now ... looks like what I need.

I will update this thread with the results later.



On Mon, Jul 23, 2012 at 10:09 PM, Daniel Roseman <daniel@roseman.org.uk> wrote:
On Monday, 23 July 2012 21:05:54 UTC+1, Lloyd Dube wrote:
Hi all,

I am not using django forms for this. I did think along the lines of doing the following:
- implement the Question form, override __init__ in the model to return answers for that question,
- instantiate a form for each question, set model=whatever_model_in_
current_loop and append it to a list,
- in the template, render them out

... but ...

How would I then access the forms collection in my view, say, from request.POST?

I think I may be trying to reinvent a wheel here.



Yes. This is what formsets are for.
--
DR. 

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/1Y1zt0RYaLMJ.

To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.



--
Regards,
Sithembewena Lloyd Dube

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment