Re: Modifying Django's User Model
Thanks for the info. I'll check it out. On Jun 12, 11:06 am, Rajesh Dwrote: > On Jun 12, 9:29 am, LeeRisq wrote: > > > I am interested in changing the primary key of the User model to email > > and also use that as the username. > > > I would like to maintain the admin interface as well. > > > I am uncertain about the ramifications of doing this. I understand > > this change will need to be reflected in other models and some views, > > but does anyone know just how deep this change would need to go? > > If you're mainly interested in making the email field unique (rather > than a PK), you could use a custom user-creation form of your own. In > your form, ensure that the clean_email method rejects duplicate > emails. If you create users through admin, unregister the built-in > UserAdmin class and reregister your own UserAdmin class that uses your > custom user-creation form. > > If you want to allow login by email instead of by username, here's a > starting point: > > http://www.djangosnippets.org/snippets/74/ > > -Rajesh D --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Modifying Django's User Model
On Jun 12, 9:29 am, LeeRisqwrote: > I am interested in changing the primary key of the User model to email > and also use that as the username. > > I would like to maintain the admin interface as well. > > I am uncertain about the ramifications of doing this. I understand > this change will need to be reflected in other models and some views, > but does anyone know just how deep this change would need to go? If you're mainly interested in making the email field unique (rather than a PK), you could use a custom user-creation form of your own. In your form, ensure that the clean_email method rejects duplicate emails. If you create users through admin, unregister the built-in UserAdmin class and reregister your own UserAdmin class that uses your custom user-creation form. If you want to allow login by email instead of by username, here's a starting point: http://www.djangosnippets.org/snippets/74/ -Rajesh D --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Modifying Django's User Model
I am interested in changing the primary key of the User model to email and also use that as the username. I would like to maintain the admin interface as well. I am uncertain about the ramifications of doing this. I understand this change will need to be reflected in other models and some views, but does anyone know just how deep this change would need to go? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---