Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You want to look at <a href="http://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users" rel="nofollow">user profiles</a>.</p> <p>EDIT: Regarding the forms, is there anything stopping you from using two forms? I think Django ignores fields in the HTTP request that don't match up to a form, so you could feed the request to two forms. When rendering a template, Django doesn't generate the <code>&lt;form&gt;</code> tags or the submit button, so you just put both forms in the same <code>&lt;form&gt;</code>. Something like this in your view (modifying a <a href="http://docs.djangoproject.com/en/1.3/topics/forms/#using-a-form-in-a-view" rel="nofollow">Django example</a>):</p> <pre><code>def edit_user_view(request): if request.method == 'POST': # If the form has been submitted... # Two forms bound to the POST data userForm = UserForm(request.POST) profileForm = ProfileForm(request.POST) if userForm.is_valid() and userForm.is_valid(): # All validation rules pass # Process the data in userForm. and profileForm.cleaned_data # ... return HttpResponseRedirect('/thanks/') # Redirect after POST else: # Unbound forms userForm = UserForm() profileForm = ProfileForm() return render_to_response('edit_user.html', { 'userForm': userForm, 'profileForm': profileForm, }) </code></pre> <p>And in the template:</p> <pre><code>&lt;form action="/contact/" method="post"&gt;{% csrf_token %} {{ userForm.as_p }} {{ profileForm.as_p }} &lt;input type="submit" value="Submit" /&gt; &lt;/form&gt; </code></pre> <p>This is really just a starting point, but I don't see any reason it can't work.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload