Works great. Thanks Julien.

On Aug 30, 9:32 pm, Julien Phalip <[EMAIL PROTECTED]> wrote:
> Keltus,
>
> The patch I mentioned in that thread solved the problem of validating
> the input. For the rendering of the form, you also need to patch the
> widget as follows:
>
> AuthenticationForm.base_fields['username'].widget.attrs['maxlength'] =
> 75
>
> Note that here 'maxlength' doesn't take an underscore.
>
> Regards,
>
> Julien
>
> On Aug 30, 4:04 pm, keltus <[EMAIL PROTECTED]> wrote:
>
>
>
> > After many frustrating hours, I have yet to monkey patch the
> > form.username variable from:
> > <input id="id_username" type="text" name="username" maxlength="30" />
> > to
> > <input id="id_username" type="text" name="username" maxlength="75" />
>
> > In my urls.py file, I added:
> > from django.contrib.auth.forms import AuthenticationForm
> > AuthenticationForm.base_fields['username'].max_length = 75
> > AuthenticationForm.base_fields['username'].label = "Email"
>
> > This is suggested by Julien in his 
> > post:http://groups.google.com/group/django-developers/msg/3420dc565df39fb1
>
> > I found that {{ form.username.label_tag }} will print "Email" as
> > expected, but {{ form.username }} still prints a max_length of 30.
>
> > I tested using:
> > assert False, dir(AuthenticationForm.base_fields['username'])
> > and indeed the max_length field is 75 (and before my code, it's 30 as
> > expected)
>
> > Why won't the maxlength html field change to 75? This perplexes me.
>
> > This is using django 1.0 beta 1, but I've also tried with django 1.0
> > beta 2 and django svn trunk.
>
> > Please advise.
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to