Hi,

as a simple idea you may overcome that by prompting user to enter
email and then generate username for a User model, if you mean it,
yourself. Of course you can leave option to enter username, but leave
email as required or allow to enter any of those in the same field.
Kind of 'slugify' will help.

apologise if that isn't what you're looking for.

Cheers

On Jul 16, 7:16 pm, selcukcihan <selcukci...@gmail.com> wrote:
> Hi, i am using email as username. Both username and email fields in
> User model always have the same value which is an email.
>
> From previous posts and code snippets, i got logins authentication and
> other stuff working. However, i just can't seem to get the admin page
> to create/modify user's whose username is an email. UserChangeForm &
> UserCreationForm tell me "This value must contain only letters,
> numbers and underscores.".
>
> To overcome this issue, i wrote the following code
>
> class OurUserChangeForm(UserChangeForm):
>     username = forms.EmailField
>
> class OurUserCreationForm(UserCreationForm):
>     username = forms.EmailField
>
> class OurUserAdmin(UserAdmin):
>     form = OurUserChangeForm
>     add_form = OurUserCreationForm
>
> and i register with
> admin.site.unregister(User)
> admin.site.register(User, OurUserAdmin)
>
> but it is not working. Any help/pointers appreciated
--~--~---------~--~----~------------~-------~--~----~
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