Consolidated email and username fields to preserve availability on both indexes
diff --git a/planetstack/core/admin.py b/planetstack/core/admin.py
index b80855ee..bae7be1 100644
--- a/planetstack/core/admin.py
+++ b/planetstack/core/admin.py
@@ -630,18 +630,18 @@
# The fields to be used in displaying the User model.
# These override the definitions on the base UserAdmin
# that reference specific fields on auth.User.
- list_display = ('email', 'username','firstname', 'lastname', 'is_admin', 'last_login')
+ list_display = ('email', 'firstname', 'lastname', 'is_admin', 'last_login')
list_filter = ()
inlines = [SlicePrivilegeInline,SitePrivilegeInline,DeploymentPrivilegeInline]
fieldsets = (
- ('Login Details', {'fields': ('email', 'username','site','password', 'is_admin', 'public_key'), 'classes':['suit-tab suit-tab-general']}),
+ ('Login Details', {'fields': ('email', 'site','password', 'is_admin', 'public_key'), 'classes':['suit-tab suit-tab-general']}),
('Contact Information', {'fields': ('firstname','lastname','phone', 'timezone'), 'classes':['suit-tab suit-tab-contact']}),
#('Important dates', {'fields': ('last_login',)}),
)
add_fieldsets = (
(None, {
'classes': ('wide',),
- 'fields': ('email', 'username','firstname', 'lastname', 'phone', 'public_key','password1', 'password2')}
+ 'fields': ('email', 'firstname', 'lastname', 'phone', 'public_key','password1', 'password2')}
),
)
search_fields = ('email',)
diff --git a/planetstack/core/models/user.py b/planetstack/core/models/user.py
index 2b63dda..32f2078 100644
--- a/planetstack/core/models/user.py
+++ b/planetstack/core/models/user.py
@@ -54,7 +54,9 @@
unique=True,
db_index=True,
)
- username = models.CharField(max_length=200, default="Something" )
+
+ username = models.CharField(max_length=255, default="Something" )
+
kuser_id = models.CharField(null=True, blank=True, help_text="keystone user id", max_length=200)
firstname = models.CharField(help_text="person's given name", max_length=200)
@@ -124,4 +126,5 @@
def save(self, *args, **kwds):
if not self.id:
self.set_password(self.password)
+ self.username = self.email
super(User, self).save(*args, **kwds)