Re: Using email instead of username in extended "User" model?
Just some more info on this - I use http://www.davidcramer.net/code/224/logging-in-with-email-addresses-in-django.html for logging in using emails. There is some discussion of this topic on http://groups.google.com/group/django-users/browse_thread/thread/c943ede66e6807c/2fbf2afeade397eb?pli=1 . And for registration, I generate a username for each user using the code at http://www.djangosnippets.org/snippets/723/ . This is mostly a rehash of what's been already said, but it seems like a summation of what I can find on the topic currently. -Saikat On Aug 4, 10:04 pm, Dana Woodman wrote: > Yeah that seems like the option Ill go with since it is probably the most > clean and future compatible. My user's dont need to log into django admin > anyways so that should suffice. Thanks everyone for the feedback! > > Cheers, > Dana > > On Mon, Aug 3, 2009 at 4:23 PM, Malcolm Tredinnick > > > > wrote: > > > On Mon, 2009-08-03 at 13:13 -0700, Dana wrote: > > > Ok, I understand the login part but what about registration? Wouldn't > > > the user's need a username still? Or am I misunderstanding... And what > > > about Django admin, it would still need a username correct? > > > Nothing stops you from creating a random string to populate the username > > field with. It has to contain a unique identifier and it's often useful > > if that is actually identifiable -- perhaps created from an amalgam of > > the user's first and last names or something -- but it could be entirely > > random, providing it is unique. > > > So when you are registering the user, just create a username string > > however you like. The user themselves doesn't have to know or care what > > it is. The thing is, their username won't change, their email address > > might (one of the many small problems with email addresses as unique and > > unchanging identifiers). > > > 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 -~--~~~~--~~--~--~---
Re: Using email instead of username in extended "User" model?
Yeah that seems like the option Ill go with since it is probably the most clean and future compatible. My user's dont need to log into django admin anyways so that should suffice. Thanks everyone for the feedback! Cheers, Dana On Mon, Aug 3, 2009 at 4:23 PM, Malcolm Tredinnick wrote: > > On Mon, 2009-08-03 at 13:13 -0700, Dana wrote: > > Ok, I understand the login part but what about registration? Wouldn't > > the user's need a username still? Or am I misunderstanding... And what > > about Django admin, it would still need a username correct? > > Nothing stops you from creating a random string to populate the username > field with. It has to contain a unique identifier and it's often useful > if that is actually identifiable -- perhaps created from an amalgam of > the user's first and last names or something -- but it could be entirely > random, providing it is unique. > > So when you are registering the user, just create a username string > however you like. The user themselves doesn't have to know or care what > it is. The thing is, their username won't change, their email address > might (one of the many small problems with email addresses as unique and > unchanging identifiers). > > 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 -~--~~~~--~~--~--~---
Re: Using email instead of username in extended "User" model?
On Mon, 2009-08-03 at 13:13 -0700, Dana wrote: > Ok, I understand the login part but what about registration? Wouldn't > the user's need a username still? Or am I misunderstanding... And what > about Django admin, it would still need a username correct? Nothing stops you from creating a random string to populate the username field with. It has to contain a unique identifier and it's often useful if that is actually identifiable -- perhaps created from an amalgam of the user's first and last names or something -- but it could be entirely random, providing it is unique. So when you are registering the user, just create a username string however you like. The user themselves doesn't have to know or care what it is. The thing is, their username won't change, their email address might (one of the many small problems with email addresses as unique and unchanging identifiers). 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 -~--~~~~--~~--~--~---
Re: Using email instead of username in extended "User" model?
Going a step backward, why cant you make username same as email. Have a custom login_required decorator that uses email and password to authenticate, override registeration pages and not show username field? It seems to work for me. On Aug 2, 4:38 pm, Dana wrote: > Hello All, > > I am looking to create a user model that extends the Auth "User" > model, like how James Bennett outlines in his article "Extending the > User Model" [1] by creating a FK to the "User" model and everything is > going fine other than one issue. > > I would like to make "email" become the unique field and not need > "username" when creating user accounts. Now, I don't mind using > username for the Django admin, but for my own user section on the > front end I want people creating accounts/logging in using an email. I > am wondering if there is any clear way of doing this without having to > roll my own auth app? > > I played with the idea of having my "save()" function create a random > username when saving but that is obviously an ugly solution. Is there > an easier way to do this that I am overlooking? > > Thanks for all your time! > Dana W > > [1]http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-m... --~--~-~--~~~---~--~~ 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: Using email instead of username in extended "User" model?
+1 thought that from the beginning! -- Sent from my Palm Pre Dana wrote: Yes, I agree that this is probably the best way to do it as I see now and I may well do that change, Im just hoping that Im missing some way to get around hacking up Django to get what I want... This seems like the one thing in the framework that is suboptimal... too bad because it is so crucial. On Aug 3, 6:26 am, cootetomwrote: > When I first started using django I was surprised that it limited > usernames and didn't allow email address's by default. It is probably > the only thing in the whole framework that I have wanted to change. > Yes it would be nice to have a clear solution rather than the approach > I have taken which is to modify the source code directly. Although > when I was faced with this problem originally I didn't like any of the > solutions that were about. In my opinion, this sort of thing should be > handled at the framework level. > > On Aug 3, 1:36 am, Russell Keith-Magee wrote: > > > On Sun, Aug 2, 2009 at 11:56 PM, David Koblas wrote: > > > > Just to add my $0.02 cents to this, I too would like a better way to > > > extend django.contrib.auth.models.User than the current approach. The > > > two biggest "problems" that I have are: > > > > * Everything depends on django.contrib.auth.models.User -- which means > > > that while you could swap out your authenticator you still basically > > > have to go and rip apart everybody's applications to support your user > > > object. > > > * To the above point, it also means that to construct your own User > > > object means you can't use contrib.admin since it depends on the User > > > object. > > > > What would be really nice is to have something like: > > > django.auth.interface.User > > > > Which in turn would instantiate something from settings.USER_MODEL > > > (default contrib.auth.modes) this might mean you could subsume > > > AUTH_PROFILE_MODULE into the USER_INSTANCE for most developers. Up shot > > > is that I can now still use public applications and the admin system, > > > but now somebody can just create a "facebook.models.User" class that > > > mirrors using facebook as the authenticator and get everything for free... > > > You aren't the first person to suggest this, and it's something I'm > > interested in looking at in the v1.2 timeframe. This is a very common > > question, and one for which Django needs to have a clear and well > > documented solution. Ticket #3011 has one solution; I'm not completely > > convinced that the patch on that ticket is the whole solution, though. > > > Yours, > > Russ Magee %-) --~--~-~--~~~---~--~~ 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: Using email instead of username in extended "User" model?
Another way to do it is to create subclasses of all the relevant classes and forms. It's easy enough to create middleware that replaces django's default user object with your own, and it's also very easy to set the admin up to use your user model instead of the default. On Aug 3, 3:15 pm, Dana wrote: > Yes, I agree that this is probably the best way to do it as I see now > and I may well do that change, Im just hoping that Im missing some way > to get around hacking up Django to get what I want... This seems like > the one thing in the framework that is suboptimal... too bad because > it is so crucial. > > On Aug 3, 6:26 am, cootetom wrote: > > > When I first started using django I was surprised that it limited > > usernames and didn't allow email address's by default. It is probably > > the only thing in the whole framework that I have wanted to change. > > Yes it would be nice to have a clear solution rather than the approach > > I have taken which is to modify the source code directly. Although > > when I was faced with this problem originally I didn't like any of the > > solutions that were about. In my opinion, this sort of thing should be > > handled at the framework level. > > > On Aug 3, 1:36 am, Russell Keith-Magee wrote: > > > > On Sun, Aug 2, 2009 at 11:56 PM, David Koblas wrote: > > > > > Just to add my $0.02 cents to this, I too would like a better way to > > > > extend django.contrib.auth.models.User than the current approach. The > > > > two biggest "problems" that I have are: > > > > > * Everything depends on django.contrib.auth.models.User -- which means > > > > that while you could swap out your authenticator you still basically > > > > have to go and rip apart everybody's applications to support your user > > > > object. > > > > * To the above point, it also means that to construct your own User > > > > object means you can't use contrib.admin since it depends on the User > > > > object. > > > > > What would be really nice is to have something like: > > > > django.auth.interface.User > > > > > Which in turn would instantiate something from settings.USER_MODEL > > > > (default contrib.auth.modes) this might mean you could subsume > > > > AUTH_PROFILE_MODULE into the USER_INSTANCE for most developers. Up shot > > > > is that I can now still use public applications and the admin system, > > > > but now somebody can just create a "facebook.models.User" class that > > > > mirrors using facebook as the authenticator and get everything for > > > > free... > > > > You aren't the first person to suggest this, and it's something I'm > > > interested in looking at in the v1.2 timeframe. This is a very common > > > question, and one for which Django needs to have a clear and well > > > documented solution. Ticket #3011 has one solution; I'm not completely > > > convinced that the patch on that ticket is the whole solution, though. > > > > Yours, > > > Russ Magee %-) --~--~-~--~~~---~--~~ 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: Using email instead of username in extended "User" model?
Yes, I agree that this is probably the best way to do it as I see now and I may well do that change, Im just hoping that Im missing some way to get around hacking up Django to get what I want... This seems like the one thing in the framework that is suboptimal... too bad because it is so crucial. On Aug 3, 6:26 am, cootetom wrote: > When I first started using django I was surprised that it limited > usernames and didn't allow email address's by default. It is probably > the only thing in the whole framework that I have wanted to change. > Yes it would be nice to have a clear solution rather than the approach > I have taken which is to modify the source code directly. Although > when I was faced with this problem originally I didn't like any of the > solutions that were about. In my opinion, this sort of thing should be > handled at the framework level. > > On Aug 3, 1:36 am, Russell Keith-Magee wrote: > > > On Sun, Aug 2, 2009 at 11:56 PM, David Koblas wrote: > > > > Just to add my $0.02 cents to this, I too would like a better way to > > > extend django.contrib.auth.models.User than the current approach. The > > > two biggest "problems" that I have are: > > > > * Everything depends on django.contrib.auth.models.User -- which means > > > that while you could swap out your authenticator you still basically > > > have to go and rip apart everybody's applications to support your user > > > object. > > > * To the above point, it also means that to construct your own User > > > object means you can't use contrib.admin since it depends on the User > > > object. > > > > What would be really nice is to have something like: > > > django.auth.interface.User > > > > Which in turn would instantiate something from settings.USER_MODEL > > > (default contrib.auth.modes) this might mean you could subsume > > > AUTH_PROFILE_MODULE into the USER_INSTANCE for most developers. Up shot > > > is that I can now still use public applications and the admin system, > > > but now somebody can just create a "facebook.models.User" class that > > > mirrors using facebook as the authenticator and get everything for free... > > > You aren't the first person to suggest this, and it's something I'm > > interested in looking at in the v1.2 timeframe. This is a very common > > question, and one for which Django needs to have a clear and well > > documented solution. Ticket #3011 has one solution; I'm not completely > > convinced that the patch on that ticket is the whole solution, though. > > > Yours, > > Russ Magee %-) --~--~-~--~~~---~--~~ 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: Using email instead of username in extended "User" model?
Ok, I understand the login part but what about registration? Wouldn't the user's need a username still? Or am I misunderstanding... And what about Django admin, it would still need a username correct? On Aug 2, 8:44 pm, Malcolm Tredinnick wrote: > On Sun, 2009-08-02 at 20:21 -0700, Dana wrote: > > Oops i mean username, not password. > > > Im not clear on how I can get this to override the django login > > functionality. Im reading more up on custom auth backends but Ill > > admit it's a little confusing. > > You write a custom authentication function that compares the username > and password supplied by the user in the login form against the email > address and password fields in the User model -- fetch the User > instance(s) matching the email address and then use the check_password() > method on the User instance to see if it's valid. > > It should only a couple of lines of code in the skeleton code described > here:http://docs.djangoproject.com/en/dev/topics/auth/#writing-an-authenti... > > 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 -~--~~~~--~~--~--~---
Re: Using email instead of username in extended "User" model?
When I first started using django I was surprised that it limited usernames and didn't allow email address's by default. It is probably the only thing in the whole framework that I have wanted to change. Yes it would be nice to have a clear solution rather than the approach I have taken which is to modify the source code directly. Although when I was faced with this problem originally I didn't like any of the solutions that were about. In my opinion, this sort of thing should be handled at the framework level. On Aug 3, 1:36 am, Russell Keith-Magee wrote: > On Sun, Aug 2, 2009 at 11:56 PM, David Koblas wrote: > > > Just to add my $0.02 cents to this, I too would like a better way to > > extend django.contrib.auth.models.User than the current approach. The > > two biggest "problems" that I have are: > > > * Everything depends on django.contrib.auth.models.User -- which means > > that while you could swap out your authenticator you still basically > > have to go and rip apart everybody's applications to support your user > > object. > > * To the above point, it also means that to construct your own User > > object means you can't use contrib.admin since it depends on the User > > object. > > > What would be really nice is to have something like: > > django.auth.interface.User > > > Which in turn would instantiate something from settings.USER_MODEL > > (default contrib.auth.modes) this might mean you could subsume > > AUTH_PROFILE_MODULE into the USER_INSTANCE for most developers. Up shot > > is that I can now still use public applications and the admin system, > > but now somebody can just create a "facebook.models.User" class that > > mirrors using facebook as the authenticator and get everything for free... > > You aren't the first person to suggest this, and it's something I'm > interested in looking at in the v1.2 timeframe. This is a very common > question, and one for which Django needs to have a clear and well > documented solution. Ticket #3011 has one solution; I'm not completely > convinced that the patch on that ticket is the whole solution, though. > > Yours, > Russ Magee %-) --~--~-~--~~~---~--~~ 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: Using email instead of username in extended "User" model?
On Sun, 2009-08-02 at 20:21 -0700, Dana wrote: > Oops i mean username, not password. > > Im not clear on how I can get this to override the django login > functionality. Im reading more up on custom auth backends but Ill > admit it's a little confusing. You write a custom authentication function that compares the username and password supplied by the user in the login form against the email address and password fields in the User model -- fetch the User instance(s) matching the email address and then use the check_password() method on the User instance to see if it's valid. It should only a couple of lines of code in the skeleton code described here: http://docs.djangoproject.com/en/dev/topics/auth/#writing-an-authentication-backend 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 -~--~~~~--~~--~--~---
Re: Using email instead of username in extended "User" model?
Oops i mean username, not password. Im not clear on how I can get this to override the django login functionality. Im reading more up on custom auth backends but Ill admit it's a little confusing. Anyone have a finished example of how I can get Django to use email to login (either by making email the username field or some other method), I learn best by example. Cheers, D On Aug 2, 7:33 pm, Dana wrote: > Tried using that but seems to not do what I need. I couldn't get an > email address to save as a password and I am not willing to modify > Django or hack my database to do it just yet. > > On Aug 2, 9:21 am, Darek wrote: > > > tips&tricks: Email addresses for user > > name:http://www.djangosnippets.org/snippets/74/ > > > On Aug 2, 5:38 pm,Dana wrote: > > > > Hello All, > > > > I am looking to create a user model that extends the Auth "User" > > > model, like how James Bennett outlines in his article "Extending the > > > User Model" [1] by creating a FK to the "User" model and everything is > > > going fine other than one issue. > > > > I would like to make "email" become the unique field and not need > > > "username" when creating user accounts. Now, I don't mind using > > > username for the Django admin, but for my own user section on the > > > front end I want people creating accounts/logging in using an email. I > > > am wondering if there is any clear way of doing this without having to > > > roll my own auth app? > > > > I played with the idea of having my "save()" function create a random > > > username when saving but that is obviously an ugly solution. Is there > > > an easier way to do this that I am overlooking? > > > > Thanks for all your time! > > >DanaW > > > > [1]http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-m... --~--~-~--~~~---~--~~ 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: Using email instead of username in extended "User" model?
Tried using that but seems to not do what I need. I couldn't get an email address to save as a password and I am not willing to modify Django or hack my database to do it just yet. On Aug 2, 9:21 am, Darek wrote: > tips&tricks: Email addresses for user > name:http://www.djangosnippets.org/snippets/74/ > > On Aug 2, 5:38 pm,Dana wrote: > > > Hello All, > > > I am looking to create a user model that extends the Auth "User" > > model, like how James Bennett outlines in his article "Extending the > > User Model" [1] by creating a FK to the "User" model and everything is > > going fine other than one issue. > > > I would like to make "email" become the unique field and not need > > "username" when creating user accounts. Now, I don't mind using > > username for the Django admin, but for my own user section on the > > front end I want people creating accounts/logging in using an email. I > > am wondering if there is any clear way of doing this without having to > > roll my own auth app? > > > I played with the idea of having my "save()" function create a random > > username when saving but that is obviously an ugly solution. Is there > > an easier way to do this that I am overlooking? > > > Thanks for all your time! > >DanaW > > > [1]http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-m... --~--~-~--~~~---~--~~ 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: Using email instead of username in extended "User" model?
Modification of Django code is not really a path I want to take, I'd prefer a cleaner approach, but thanks for the suggestion! On Aug 2, 11:39 am, cootetom wrote: > Another option you have is to modify the User model directly in the > django source code. > > You will need to edit: > django.contrib.auth.models.User > django.contrib.auth.forms.UserCreationForm > django.contrib.auth.forms.AuthenticationForm > > Find the username field and use the forms.EmailField instead. > > On Aug 2, 4:56 pm, David Koblas wrote: > > > Just to add my $0.02 cents to this, I too would like a better way to > > extend django.contrib.auth.models.User than the current approach. The > > two biggest "problems" that I have are: > > > * Everything depends on django.contrib.auth.models.User -- which means > > that while you could swap out your authenticator you still basically > > have to go and rip apart everybody's applications to support your user > > object. > > * To the above point, it also means that to construct your own User > > object means you can't use contrib.admin since it depends on the User > > object. > > > What would be really nice is to have something like: > > django.auth.interface.User > > > Which in turn would instantiate something from settings.USER_MODEL > > (default contrib.auth.modes) this might mean you could subsume > > AUTH_PROFILE_MODULE into the USER_INSTANCE for most developers. Up shot > > is that I can now still use public applications and the admin system, > > but now somebody can just create a "facebook.models.User" class that > > mirrors using facebook as the authenticator and get everything for free... > > > --koblas > > >Danawrote: > > > Hello All, > > > > I am looking to create a user model that extends the Auth "User" > > > model, like how James Bennett outlines in his article "Extending the > > > User Model" [1] by creating a FK to the "User" model and everything is > > > going fine other than one issue. > > > > I would like to make "email" become the unique field and not need > > > "username" when creating user accounts. Now, I don't mind using > > > username for the Django admin, but for my own user section on the > > > front end I want people creating accounts/logging in using an email. I > > > am wondering if there is any clear way of doing this without having to > > > roll my own auth app? > > > > I played with the idea of having my "save()" function create a random > > > username when saving but that is obviously an ugly solution. Is there > > > an easier way to do this that I am overlooking? > > > > Thanks for all your time! > > >DanaW > > > > [1]http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-m... --~--~-~--~~~---~--~~ 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: Using email instead of username in extended "User" model?
On Sun, Aug 2, 2009 at 11:56 PM, David Koblas wrote: > > Just to add my $0.02 cents to this, I too would like a better way to > extend django.contrib.auth.models.User than the current approach. The > two biggest "problems" that I have are: > > * Everything depends on django.contrib.auth.models.User -- which means > that while you could swap out your authenticator you still basically > have to go and rip apart everybody's applications to support your user > object. > * To the above point, it also means that to construct your own User > object means you can't use contrib.admin since it depends on the User > object. > > What would be really nice is to have something like: > django.auth.interface.User > > Which in turn would instantiate something from settings.USER_MODEL > (default contrib.auth.modes) this might mean you could subsume > AUTH_PROFILE_MODULE into the USER_INSTANCE for most developers. Up shot > is that I can now still use public applications and the admin system, > but now somebody can just create a "facebook.models.User" class that > mirrors using facebook as the authenticator and get everything for free... You aren't the first person to suggest this, and it's something I'm interested in looking at in the v1.2 timeframe. This is a very common question, and one for which Django needs to have a clear and well documented solution. Ticket #3011 has one solution; I'm not completely convinced that the patch on that ticket is the whole solution, though. Yours, Russ Magee %-) --~--~-~--~~~---~--~~ 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: Using email instead of username in extended "User" model?
Another option you have is to modify the User model directly in the django source code. You will need to edit: django.contrib.auth.models.User django.contrib.auth.forms.UserCreationForm django.contrib.auth.forms.AuthenticationForm Find the username field and use the forms.EmailField instead. On Aug 2, 4:56 pm, David Koblas wrote: > Just to add my $0.02 cents to this, I too would like a better way to > extend django.contrib.auth.models.User than the current approach. The > two biggest "problems" that I have are: > > * Everything depends on django.contrib.auth.models.User -- which means > that while you could swap out your authenticator you still basically > have to go and rip apart everybody's applications to support your user > object. > * To the above point, it also means that to construct your own User > object means you can't use contrib.admin since it depends on the User > object. > > What would be really nice is to have something like: > django.auth.interface.User > > Which in turn would instantiate something from settings.USER_MODEL > (default contrib.auth.modes) this might mean you could subsume > AUTH_PROFILE_MODULE into the USER_INSTANCE for most developers. Up shot > is that I can now still use public applications and the admin system, > but now somebody can just create a "facebook.models.User" class that > mirrors using facebook as the authenticator and get everything for free... > > --koblas > > Dana wrote: > > Hello All, > > > I am looking to create a user model that extends the Auth "User" > > model, like how James Bennett outlines in his article "Extending the > > User Model" [1] by creating a FK to the "User" model and everything is > > going fine other than one issue. > > > I would like to make "email" become the unique field and not need > > "username" when creating user accounts. Now, I don't mind using > > username for the Django admin, but for my own user section on the > > front end I want people creating accounts/logging in using an email. I > > am wondering if there is any clear way of doing this without having to > > roll my own auth app? > > > I played with the idea of having my "save()" function create a random > > username when saving but that is obviously an ugly solution. Is there > > an easier way to do this that I am overlooking? > > > Thanks for all your time! > > Dana W > > > [1]http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-m... --~--~-~--~~~---~--~~ 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: Using email instead of username in extended "User" model?
tips&tricks: Email addresses for user name: http://www.djangosnippets.org/snippets/74/ On Aug 2, 5:38 pm, Dana wrote: > Hello All, > > I am looking to create a user model that extends the Auth "User" > model, like how James Bennett outlines in his article "Extending the > User Model" [1] by creating a FK to the "User" model and everything is > going fine other than one issue. > > I would like to make "email" become the unique field and not need > "username" when creating user accounts. Now, I don't mind using > username for the Django admin, but for my own user section on the > front end I want people creating accounts/logging in using an email. I > am wondering if there is any clear way of doing this without having to > roll my own auth app? > > I played with the idea of having my "save()" function create a random > username when saving but that is obviously an ugly solution. Is there > an easier way to do this that I am overlooking? > > Thanks for all your time! > Dana W > > [1]http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-m... --~--~-~--~~~---~--~~ 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: Using email instead of username in extended "User" model?
Just to add my $0.02 cents to this, I too would like a better way to extend django.contrib.auth.models.User than the current approach. The two biggest "problems" that I have are: * Everything depends on django.contrib.auth.models.User -- which means that while you could swap out your authenticator you still basically have to go and rip apart everybody's applications to support your user object. * To the above point, it also means that to construct your own User object means you can't use contrib.admin since it depends on the User object. What would be really nice is to have something like: django.auth.interface.User Which in turn would instantiate something from settings.USER_MODEL (default contrib.auth.modes) this might mean you could subsume AUTH_PROFILE_MODULE into the USER_INSTANCE for most developers. Up shot is that I can now still use public applications and the admin system, but now somebody can just create a "facebook.models.User" class that mirrors using facebook as the authenticator and get everything for free... --koblas Dana wrote: > Hello All, > > I am looking to create a user model that extends the Auth "User" > model, like how James Bennett outlines in his article "Extending the > User Model" [1] by creating a FK to the "User" model and everything is > going fine other than one issue. > > I would like to make "email" become the unique field and not need > "username" when creating user accounts. Now, I don't mind using > username for the Django admin, but for my own user section on the > front end I want people creating accounts/logging in using an email. I > am wondering if there is any clear way of doing this without having to > roll my own auth app? > > I played with the idea of having my "save()" function create a random > username when saving but that is obviously an ugly solution. Is there > an easier way to do this that I am overlooking? > > Thanks for all your time! > Dana W > > [1] http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/ > > > --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Using email instead of username in extended "User" model?
Hello All, I am looking to create a user model that extends the Auth "User" model, like how James Bennett outlines in his article "Extending the User Model" [1] by creating a FK to the "User" model and everything is going fine other than one issue. I would like to make "email" become the unique field and not need "username" when creating user accounts. Now, I don't mind using username for the Django admin, but for my own user section on the front end I want people creating accounts/logging in using an email. I am wondering if there is any clear way of doing this without having to roll my own auth app? I played with the idea of having my "save()" function create a random username when saving but that is obviously an ugly solution. Is there an easier way to do this that I am overlooking? Thanks for all your time! Dana W [1] http://www.b-list.org/weblog/2006/jun/06/django-tips-extending-user-model/ --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---