xxxxxxxxxx
>>> from django.contrib.auth.models import User
>>> user = User.objects.create_user("john", "lennon@thebeatles.com", "johnpassword")
# At this point, user is a User object that has already been saved
# to the database. You can continue to change its attributes
# if you want to change other fields.
>>> user.last_name = "Lennon"
>>> user.save()
xxxxxxxxxx
>>> from django.contrib.auth.models import User
>>> user = User.objects.create_user('john', 'lennon@thebeatles.com', 'johnpassword')
# At this point, user is a User object that has already been saved
# to the database. You can continue to change its attributes
# if you want to change other fields.
>>> user.last_name = 'Lennon'
>>> user.save()
xxxxxxxxxx
# Django User Model Fields
username
first_name
last_name
email
password
groups
user_permissions
is_staff
is_active
is_superuser
last_login
date_joined
xxxxxxxxxx
from django.contrib.auth.models import User
user = User.objects.create_user('john', 'lennon@thebeatles.com', 'johnpassword')
user.save()
xxxxxxxxxx
from django.contrib.auth.models import User
image.mefiz.com
https://github.com/MominIqbal-1234
xxxxxxxxxx
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.utils.translation import ugettext_lazy as _# Create your models here.class User(AbstractUser):
username = models.CharField(max_length=30, unique=True)
email = models.EmailField(_('email address'), max_length=254,unique=True, null=True, blank=True)
avtar = models.ImageField(upload_to='thumbpath', blank=True)
mobile_no = models.CharField(max_lenght=15) class Meta(AbstractUser.Meta):
swappable = 'AUTH_USER_MODEL'