Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
concrexit
Commits
7c8be8d5
Verified
Commit
7c8be8d5
authored
Sep 20, 2018
by
Sébastiaan Versteeg
Browse files
Add check to model for registrations with same email
parent
5812cf68
Changes
1
Show whitespace changes
Inline
Side-by-side
website/registrations/models.py
View file @
7c8be8d5
...
@@ -245,7 +245,9 @@ class Registration(Entry):
...
@@ -245,7 +245,9 @@ class Registration(Entry):
super
().
clean
()
super
().
clean
()
errors
=
{}
errors
=
{}
if
get_user_model
().
objects
.
filter
(
email
=
self
.
email
).
exists
():
if
(
get_user_model
().
objects
.
filter
(
email
=
self
.
email
).
exists
()
or
Registration
.
objects
.
filter
(
email
=
self
.
email
)
.
exclude
(
pk
=
self
.
pk
).
exists
()):
errors
.
update
({
errors
.
update
({
'email'
:
_
(
'A user with that email address already exists. '
'email'
:
_
(
'A user with that email address already exists. '
'Login using the existing account and renew the '
'Login using the existing account and renew the '
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment