add timezone field to user
diff --git a/planetstack/core/admin.py b/planetstack/core/admin.py
index 0329cd6..85bed74 100644
--- a/planetstack/core/admin.py
+++ b/planetstack/core/admin.py
@@ -424,7 +424,7 @@
list_filter = ('site',)
inlines = [SitePrivilegeInline, SliceMembershipInline]
fieldsets = (
- (None, {'fields': ('email', 'password', 'site', 'is_admin')}),
+ (None, {'fields': ('email', 'password', 'site', 'is_admin', 'timezone')}),
('Personal info', {'fields': ('firstname','lastname','phone', 'key')}),
#('Important dates', {'fields': ('last_login',)}),
)
diff --git a/planetstack/core/models/user.py b/planetstack/core/models/user.py
index e6c42e7..055b6cd 100644
--- a/planetstack/core/models/user.py
+++ b/planetstack/core/models/user.py
@@ -6,6 +6,7 @@
from core.models import Site
from core.models import Key
from django.contrib.auth.models import AbstractBaseUser, BaseUserManager
+from timezones.fields import TimeZoneField
# Create your models here.
class UserManager(BaseUserManager):
@@ -68,6 +69,8 @@
is_admin = models.BooleanField(default=True)
is_staff = models.BooleanField(default=True)
+ timezone = TimeZoneField()
+
objects = UserManager()
USERNAME_FIELD = 'email'
@@ -95,8 +98,8 @@
return True
def get_roles(self):
- from plstackapi.core.models.site import SitePrivilege
- from plstackapi.core.models.slice import SliceMembership
+ from core.models.site import SitePrivilege
+ from core.models.slice import SliceMembership
site_privileges = SitePrivilege.objects.filter(user=self)
slice_memberships = SliceMembership.objects.filter(user=self)