CORD-1746: Username defaulting to email even when it is set
Change-Id: Ibdfcbf6eb81a4d25ae2664e1ca888beb1cafcc92
(cherry picked from commit 8a34a8ecdff58bafc9a6e0f04fe156db8e56fcc3)
diff --git a/README.md b/README.md
index 0b93d3f..dc673ad 100644
--- a/README.md
+++ b/README.md
@@ -21,3 +21,4 @@
version is configured with a service graph that includes
`ExampleService`, which is a good platform for understanding how to
build and use XOS.
+
diff --git a/xos/core/models/user.py b/xos/core/models/user.py
index e4306c5..d8dd616 100644
--- a/xos/core/models/user.py
+++ b/xos/core/models/user.py
@@ -299,7 +299,8 @@
if (caller_kind!="synchronizer") or always_update_timestamp:
self.updated = timezone.now()
- self.username = self.email
+ if not self.username:
+ self.username = self.email
super(User, self).save(*args, **kwargs)