Remove timezone

This commit is contained in:
Matthew Ryan Dillon 2016-06-08 11:50:46 -07:00
parent d7b1910839
commit 6162bd984f
4 changed files with 18 additions and 20 deletions

View file

@ -1,13 +0,0 @@
import pytz
from django.utils import timezone
class TimezoneMiddleware(object):
def process_request(self, request):
if not request.user.is_anonymous():
tzname = request.user.timezone
if tzname:
timezone.activate(pytz.timezone(tzname))
else:
timezone.deactivate()

View file

@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('users', '0002_timezone'),
]
operations = [
migrations.RemoveField(
model_name='user',
name='timezone',
),
]

View file

@ -3,15 +3,9 @@ from django.core.urlresolvers import reverse
from django.db import models
from django.utils.translation import ugettext_lazy as _
import pytz
class User(AbstractUser):
name = models.CharField(_("Name of User"), blank=True, max_length=255)
timezone = models.CharField(_("Current Timezone"), max_length=255,
default="UTC",
choices=[(x, x) for x in pytz.common_timezones],
blank=False)
def __str__(self):
return self.username

View file

@ -58,7 +58,6 @@ MIDDLEWARE_CLASSES = (
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'ccdb.users.middleware.TimezoneMiddleware',
)
# DEBUG