Cheers :)

Damn, I must have been a bit tired coding that up lol

Here's my working code (incase anyone else is as stupid as me):

<form method="POST" action="/accounts/login/">
  <label style="font-weight:bold;">Login:</label>
  <label for="login_username">Username: </label>
  <input id="id_login_username" name="login_username" type="text"
value="{{ username }}" />
  <label for="login_password">Password:</label>
  <input id="id_login_password" name="login_password" type="password" /
>
  <input type="submit" value="login" />
</form>

On Dec 23, 4:23 pm, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:
> On Mon, 2008-12-22 at 19:03 -0800, DragonSlayre wrote:
> > I've created my own form:
>
> > <form method="POST" action="/accounts/login/">
> >   <label id="login" style="font-weight:bold;">Login:</label>
> >   <label id="login_username" value="{{ username }}">Username: </label>
> >   <input type="text" />
> >   <label id="login_password">Password:</label>
> >   <input type="password" />
> >   <input type="submit" value="login" />
> > </form>
>
> > I am mappying /accounts/login/ to a view of mine, which is then
> > calling:
>
> > if request.method == 'POST':
> >         username = request.POST['login_username']
>
> > I have no idea why I'm getting the error - "Key 'login_username' not
> > found in <QueryDict: {}>".
>
> > What am I doing wrong?
>
> login_username is the value of the id attribute on the label, not on the
> form input element. Basically, your HTML isn't correct for the type of
> form you're after. You need to identify the form input elements, rather
> than the label elements. Compare the output from a Django form to what
> you have an you should see the difference fairly quickly.
>
> Regards,
> Malcolm
--~--~---------~--~----~------------~-------~--~----~
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