On Mon, Mar 23, 2009 at 4:45 PM, Adam Yee <adamj...@gmail.com> wrote:
> > I'm using Django's builtin AuthenticationForm > > Here's my login view: http://dpaste.com/18110/ > > Form submittal (not empty or empty fields) takes me back to the login > page with 'Did not login'. My debugging print statement isn't showing > up in the terminal, so is_valid is somehow returning false. > > If I submit with empty fields, I don't get the default 'This field is > required' type of error messages that I would expect. I'm not sure > how clean() is working with the AuthenticationForm... Am I validating > correctly? Or is something happening in the authentication process? > Thanks. > > Your error() function is creating a brand-new blank AuthenticationForm that is passed in the context to the template, so the specific error message associated with whatever caused is_valid() to fail (which has been added to the original form's error_list) is being thrown away. If instead you pass back the form you called is_valid() on, then the template would be able to report the specific error that is causing the validation failure. 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 -~----------~----~----~----~------~----~------~--~---