On Mar 28, 9:31 pm, Matthew Somerville <matthew-dja...@dracos.co.uk>
wrote:
> Joshua Partogi wrote:
> > That is exactly the problem. No exception is thrown. But I guess it
> > didn't pass the validation because it wasn't redirecting to another
> > page. Which is funny because all the required field in
> > django.contrib.auth.models.User object is filled in.
>
> How are you printing out the form in the template? If it's not
> redirecting, it's not validating, so there's an error - make sure you're
> printing out all the errors in the template. Without any more clues, it
> could be something as simple as your form has method GET rather than
> POST. ;) But I'm guessing you don't want your registration form to have
> all the fields from the User model (such as is_superuser), and you're
> printing out only those ones you do want in the template, rather than
> restricting the form with the fields Meta variable, and so aren't
> printing out the error messages correctly. That's just a guess.

Yes you're right. In my template I only have username, first_name,
last_name, email and password. I also print out the errors too.
        <form action="/register/" method="post">
        <p>
            {{ form.first_name.errors }}
            <span><label>First Name</label></span>
            <span>{{ form.first_name }}</span>
        </p>
        <p>
            {{ form.last_name.errors }}
            <span><label>Last Name</label></span>
            <span>{{ form.last_name }}</span>
        </p>
        <p>
            {{ form.username.errors }}
            <span><label>Username</label></span>
            <span>{{ form.username }}</span>
        </p>
        <p>
            {{ form.password.errors }}
            <span><label>Password</label></span>
            <span>{{ form.password }}</span>
        </p>
        <p>
            {{ form.email.errors }}
            <span><label>E-mail</label></span>
            <span>{{ form.email }}</span>
        </p>
     </form>

Are you saying that I should have all the other fields from
django.contrib.auth.models.User too?

Thank you very much.
--~--~---------~--~----~------------~-------~--~----~
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