I will give you one more complete example:
Custom a User is not easy you need to do many things:
In that link django-docs explain all for you and there is an example with
email field.
https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#a-full-example
My tip is: In the docs there is
You can inheriant of AbstractBaseUser and define your field:
from django.contrib.auth.models import AbstractBaseUser
class MyCustomUser(AbstractBaseUser):
mail = models.EmailField(max_lenght=254)
REQUIRED_FIELDS = ['mail']
# more code
Please sorry about my english, I'm a Brazili
Is it the same if I want to specify email as required field, isn't?
El diumenge, 22 març de 2015 15:55:33 UTC+1, Tim Graham va escriure:
>
> Currently you need to use a custom user model if you want to change the
> username max_length. There's an open ticket to increase the default length
> to 2
Hi
I have been using this patch to get around the short user name (which is 30
characters):
#--
#
# Patch to allow username to exceed the default maximum of 30 characters
#
# http://stackoverflow.com/a/6453368/1228131
#
# No
Currently you need to use a custom user model if you want to change the
username max_length. There's an open ticket to increase the default length
to 254 though: https://code.djangoproject.com/ticket/20846
On Sunday, March 22, 2015 at 10:45:34 AM UTC-4, somen...@gmail.com wrote:
>
> Thanks, Ande
Thanks, Anderson, but can I overwrite the length of User class? How? Sorry
I'm still a newbee? With AbstractUser?
[https://docs.djangoproject.com/en/1.7/topics/auth/customizing/#django.contrib.auth.models.CustomUser]
or Extending user class
[https://docs.djangoproject.com/en/1.7/topics/auth/cu
No, the user class uses 75. You need to change to 254.
models.EmailField(max_lenght=254)
>
>
--
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+unsub
7 matches
Mail list logo