Skip to content

Commit

Permalink
Fix error when creating users with non-writable email attribute (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky authored Jun 30, 2019
1 parent 3fe53ae commit b2c3d12
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
7 changes: 6 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
History
-------

1.2.0 (unreleased)
1.2.1 (2019-06-30)
++++++++++++++++++

* Fixed error when creating users with non-writable email attribute

1.2.0 (2019-03-22)
++++++++++++++++++

* Dropped compatiblity with Django <1.11, Python 3.4
Expand Down
5 changes: 4 additions & 1 deletion djangocms_helper/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,10 @@ def create_user(username, email, password, is_staff=False, is_superuser=False,
if User.USERNAME_FIELD != 'email':
setattr(user, User.USERNAME_FIELD, username)

user.email = email
try:
user.email = email
except AttributeError:
pass
user.set_password(password)
if is_superuser:
user.is_superuser = True
Expand Down

0 comments on commit b2c3d12

Please sign in to comment.