Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
hypha
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ots
hypha
Commits
87906b84
Commit
87906b84
authored
7 years ago
by
Dan Braghis
Browse files
Options
Downloads
Patches
Plain Diff
Revert back to using AbstractUser
parent
889903c8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
opentech/apply/users/migrations/0004_drop_first_last_names.py
+0
-9
0 additions, 9 deletions
...tech/apply/users/migrations/0004_drop_first_last_names.py
opentech/apply/users/models.py
+6
-24
6 additions, 24 deletions
opentech/apply/users/models.py
with
6 additions
and
33 deletions
opentech/apply/users/migrations/0004_drop_first_last_names.py
+
0
−
9
View file @
87906b84
...
@@ -12,10 +12,6 @@ class Migration(migrations.Migration):
...
@@ -12,10 +12,6 @@ class Migration(migrations.Migration):
]
]
operations
=
[
operations
=
[
migrations
.
AlterModelOptions
(
name
=
'
user
'
,
options
=
{
'
ordering
'
:
[
'
id
'
]},
),
migrations
.
RemoveField
(
migrations
.
RemoveField
(
model_name
=
'
user
'
,
model_name
=
'
user
'
,
name
=
'
first_name
'
,
name
=
'
first_name
'
,
...
@@ -29,9 +25,4 @@ class Migration(migrations.Migration):
...
@@ -29,9 +25,4 @@ class Migration(migrations.Migration):
name
=
'
full_name
'
,
name
=
'
full_name
'
,
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
verbose_name
=
'
Full name
'
),
field
=
models
.
CharField
(
blank
=
True
,
max_length
=
255
,
verbose_name
=
'
Full name
'
),
),
),
migrations
.
AlterField
(
model_name
=
'
user
'
,
name
=
'
email
'
,
field
=
models
.
EmailField
(
max_length
=
255
,
unique
=
True
,
verbose_name
=
'
email address
'
),
),
]
]
This diff is collapsed.
Click to expand it.
opentech/apply/users/models.py
+
6
−
24
View file @
87906b84
from
django.db
import
models
from
django.db
import
models
from
django.contrib.auth.models
import
AbstractBaseUser
,
BaseUserManager
,
PermissionsMixin
from
django.contrib.auth.models
import
AbstractUser
,
BaseUserManager
from
django.core.mail
import
send_mail
from
django.utils
import
timezone
from
django.utils.translation
import
gettext_lazy
as
_
from
django.utils.translation
import
gettext_lazy
as
_
from
.utils
import
send_activation_email
from
.utils
import
send_activation_email
...
@@ -46,32 +44,20 @@ class UserManager(BaseUserManager):
...
@@ -46,32 +44,20 @@ class UserManager(BaseUserManager):
return
user
,
created
return
user
,
created
class
User
(
Abstract
BaseUser
,
PermissionsMixin
):
class
User
(
Abstract
User
):
email
=
models
.
EmailField
(
_
(
'
email address
'
),
max_length
=
255
,
unique
=
True
)
email
=
models
.
EmailField
(
_
(
'
email address
'
),
unique
=
True
)
full_name
=
models
.
CharField
(
verbose_name
=
'
Full name
'
,
max_length
=
255
,
blank
=
True
)
full_name
=
models
.
CharField
(
verbose_name
=
'
Full name
'
,
max_length
=
255
,
blank
=
True
)
is_staff
=
models
.
BooleanField
(
verbose_name
=
'
staff status
'
,
default
=
False
,
help_text
=
'
Designates whether the user can log into this admin site.
'
,
)
is_active
=
models
.
BooleanField
(
verbose_name
=
'
active
'
,
default
=
True
,
help_text
=
'
Designates whether this user should be treated as active.
'
'
Unselect this instead of deleting accounts.
'
,
)
date_joined
=
models
.
DateTimeField
(
verbose_name
=
'
date joined
'
,
default
=
timezone
.
now
)
USERNAME_FIELD
=
'
email
'
USERNAME_FIELD
=
'
email
'
REQUIRED_FIELDS
=
[]
REQUIRED_FIELDS
=
[]
# Remove the username field which is no longer used
# Remove the username
/first/last name
field which is no longer used
.
username
=
None
username
=
None
first_name
=
None
last_name
=
None
objects
=
UserManager
()
objects
=
UserManager
()
class
Meta
:
ordering
=
[
'
id
'
]
def
__str__
(
self
):
def
__str__
(
self
):
return
self
.
get_full_name
()
return
self
.
get_full_name
()
...
@@ -81,7 +67,3 @@ class User(AbstractBaseUser, PermissionsMixin):
...
@@ -81,7 +67,3 @@ class User(AbstractBaseUser, PermissionsMixin):
def
get_short_name
(
self
):
def
get_short_name
(
self
):
return
self
.
email
return
self
.
email
def
email_user
(
self
,
subject
,
message
,
from_email
=
None
,
**
kwargs
):
"""
Send an email to this user.
"""
send_mail
(
subject
,
message
,
from_email
,
[
self
.
email
],
**
kwargs
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment