Are you the one who is doing "Getting Started With Django" ? Sorry for getting off topic but just was curious. If so I donated money to that project and I am glad you are doing it.
Yes, that's what it seems to be called by other Django devs, "Email address as username." I prefer more to think of it as just "Email" with the same exact login handlign as "Username." That's my goal with this post is keep pushing until the point is reached where we can just call it "Email" login. I also think it is such a common case that it should be within Django's core. It is obvious from the large number of posts online about replacing the username with an email. If you have heard Jacob discussing it before, that would be wonderful! It would be awesome if the Django guys accepted this into Django all together. Given it must be considered with the release of Django 1.5 they did give a lot more support to people like me trying to have the email as the username through things like:
class CustomUser(AbstractBaseUser, PermissionsMixin): .... email = models.EmailField(max_length=255, unique=True) .... objects = CustomUserManager() USERNAME_FIELD = 'email'
So maybe Jacob and Adrian are already on top of this. The only thing I have been trying to do is follow the suggestions of those posts I have found online. I could surely route some possible people I think might have already banged this out but I'm not sure I'm the best bet. However, I did go ahead and open a ticket:
https://code.djangoproject.com/ticket/20824
Thanks again to all the Django developers for their hard work,
JJ
On Friday, July 26, 2013 9:21:04 PM UTC-4, Russell Keith-Magee wrote:
On Fri, Jul 26, 2013 at 10:43 PM, JJ Zolper <codin...@gmail.com> wrote:Hello everyone,So I want to say thanks to the Django guys for providing more support for those of us that want to use a user's email as the UID and login handler versus the previous method of handling based on the username. I and probably many others appreciate the effort given to the topic and that it was integrated into Django 1.5.Today I would like to request a continuing expansion about this concept.In referencing this link:I would like to request that if we want to make email the UID we don't have to do things such as:class MyUser(AbstractBaseUser, PermissionsMixin):
....
is_staff = models.BooleanField('staff status', default=False,
help_text='Designates whether the user can log into this admin '
'site.')
is_active = models.BooleanField('active', default=True,
help_text='Designates whether this user should be treated as '
'active. Unselect this instead of deleting accounts.')
def get_full_name(self):
full_name = '%s %s' % (self.first_name, self.last_name)
return full_name.strip()
def get_short_name(self):
return self.first_name
just to retain what could already be apart of Django. You guys know more about Django then I ever will and what the best way is to go about it but if we can eliminate additional code that is already in Django that would be wonderful.
Now in referencing:
Basically what I'm saying is, we shouldn't have to do what this fellow had to do:
Unfortunately there's nothing within
django.contrib.auth
that you can simply subclass to get a model that has
email address in place of user name and
works nicely with other
django.contrib.auth
-stuff, like groups. The simplest approach is to copy
models.py
,admin.py
andf
fromorms.py django.contrib.
, rip out user name all over the place and put in email address in it's place. I've done just that and I'm using it successfully in a couple of client projects.auth I've put it up on github and pypi so you can install it with
pip install django-libtech-emailuser
I thank you for your time and I appreciate your consideration for integrating this once and for all into Django.
Hi JJ,That's a fair comment -- "Email address as username" is a sufficiently common use case that it probably warrants being included in Django's core. I think I've overheard Jacob endorsing the same thing at some point in the past (although I'll stand corrected on this if I misheard/misunderstood/misattributed his comments). If you've already done the heavy lifting here, then all we need to do is massage your external package into contrib. Open a ticket and we can see what we can do about getting this in for 1.7.Yours,Russ Magee %-)
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment