Re: Process multiple html forms in the same view

2009-04-14 Thread Bastien

Thank you Karen, that's exactly what I need "To give each Form its own
namespace".

On Apr 13, 10:57 pm, Karen Tracey  wrote:
> On Mon, Apr 13, 2009 at 2:11 PM, Bastien  wrote:
> > ... So my question is how could the
> > view know which POST data belongs to which form or how can I change
> > the form fields name like the profile tags and post tags would become
> > tags_profile and tags_post respectively?
>
> I think you want to specify a prefix for your individual forms:
>
> http://docs.djangoproject.com/en/dev/ref/forms/api/#prefixes-for-forms
>
> Karen
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: Process multiple html forms in the same view

2009-04-13 Thread Karen Tracey
On Mon, Apr 13, 2009 at 2:11 PM, Bastien  wrote:

> ... So my question is how could the
> view know which POST data belongs to which form or how can I change
> the form fields name like the profile tags and post tags would become
> tags_profile and tags_post respectively?


I think you want to specify a prefix for your individual forms:

http://docs.djangoproject.com/en/dev/ref/forms/api/#prefixes-for-forms

Karen

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



Process multiple html forms in the same view

2009-04-13 Thread Bastien

I have a classic user profile page where the user fills a form with
various field about her profile (name, address, about me...). On the
same page I have another form that is very similar to a blog post
entry (title, body...) that represents a message that the user can
optionaly fill if she wants to. I can only have one submit button for
the whole page and thus the 2 forms. They both submit the POST data to
the same URL (user_ profile) and in the view I process both forms.
Everything runs quite smoothly since the validation process
automatically uses the POST data that it needs and leaves the rest
(ie: validating user profile only uses the form values like name,
address, about me... and leaves things like title, body... for later
use). But my problem is that I have a few form fields in common in
both forms: zone (which is a list of geographical zones relevant to
the website), theme (another list) and the tags field. The view in its
current form is unabled to tell apart which one is from which form,
ie: it receives tags from both the user profile and the user optional
message and can't tell them apart. So my question is how could the
view know which POST data belongs to which form or how can I change
the form fields name like the profile tags and post tags would become
tags_profile and tags_post respectively?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---