diff --git a/symposion/boxes/urls.py b/symposion/boxes/urls.py index c0cf3fb1..993ec136 100644 --- a/symposion/boxes/urls.py +++ b/symposion/boxes/urls.py @@ -1,5 +1,4 @@ -# flake8: noqa -from django.conf.urls.defaults import url, patterns +from django.conf.urls import url, patterns urlpatterns = patterns("symposion.boxes.views", diff --git a/symposion/cms/urls.py b/symposion/cms/urls.py index be16e2cd..74064edb 100644 --- a/symposion/cms/urls.py +++ b/symposion/cms/urls.py @@ -1,5 +1,5 @@ -# flake8: noqa -from django.conf.urls.defaults import url, patterns +from django.conf.urls import url, patterns + PAGE_RE = r"(([\w-]{1,})(/[\w-]{1,})*)/" diff --git a/symposion/conference/urls.py b/symposion/conference/urls.py index f2cdd52b..90ae79f8 100644 --- a/symposion/conference/urls.py +++ b/symposion/conference/urls.py @@ -1,5 +1,4 @@ -# flake8: noqa -from django.conf.urls.defaults import patterns, url +from django.conf.urls import patterns, url urlpatterns = patterns("symposion.conference.views", diff --git a/symposion/proposals/models.py b/symposion/proposals/models.py index c12c5bcc..699f70b6 100644 --- a/symposion/proposals/models.py +++ b/symposion/proposals/models.py @@ -1,4 +1,3 @@ -import datetime import os import uuid @@ -6,6 +5,7 @@ from django.core.urlresolvers import reverse from django.db import models from django.db.models import Q from django.utils.translation import ugettext_lazy as _ +from django.utils.timezone import now from django.contrib.auth.models import User @@ -37,20 +37,18 @@ class ProposalSection(models.Model): @classmethod def available(cls): - now = datetime.datetime.now() return cls._default_manager.filter( - Q(start__lt=now) | Q(start=None), - Q(end__gt=now) | Q(end=None), + Q(start__lt=now()) | Q(start=None), + Q(end__gt=now()) | Q(end=None), Q(closed=False) | Q(closed=None), ) def is_available(self): if self.closed: return False - now = datetime.datetime.now() - if self.start and self.start > now: + if self.start and self.start > now(): return False - if self.end and self.end < now: + if self.end and self.end < now(): return False return True @@ -102,7 +100,7 @@ class ProposalBase(models.Model): "target='_blank'>Markdown.") ) submitted = models.DateTimeField( - default=datetime.datetime.now, + default=now, editable=False, ) speaker = models.ForeignKey("speakers.Speaker", related_name="proposals") @@ -175,7 +173,8 @@ class SupportingDocument(models.Model): proposal = models.ForeignKey(ProposalBase, related_name="supporting_documents") uploaded_by = models.ForeignKey(User) - created_at = models.DateTimeField(default=datetime.datetime.now) + + created_at = models.DateTimeField(default=now) file = models.FileField(upload_to=uuid_filename) description = models.CharField(max_length=140) diff --git a/symposion/proposals/urls.py b/symposion/proposals/urls.py index c2efdcb5..a69e6136 100644 --- a/symposion/proposals/urls.py +++ b/symposion/proposals/urls.py @@ -1,5 +1,4 @@ -# flake8: noqa -from django.conf.urls.defaults import * +from django.conf.urls import patterns, url urlpatterns = patterns("symposion.proposals.views", diff --git a/symposion/proposals/views.py b/symposion/proposals/views.py index b3a3edfe..570e988b 100644 --- a/symposion/proposals/views.py +++ b/symposion/proposals/views.py @@ -7,7 +7,12 @@ from django.core.urlresolvers import reverse from django.db.models import Q from django.http import Http404, HttpResponse, HttpResponseForbidden from django.shortcuts import render, redirect, get_object_or_404 -from django.utils.hashcompat import sha_constructor + +try: + from hashlib import sha1 as sha_constructor +except ImportError: + from django.utils.hashcompat import sha_constructor + from django.views import static from django.contrib import messages diff --git a/symposion/reviews/urls.py b/symposion/reviews/urls.py index 3cdc6f73..1719eb0e 100644 --- a/symposion/reviews/urls.py +++ b/symposion/reviews/urls.py @@ -1,5 +1,4 @@ -# flake8: noqa -from django.conf.urls.defaults import patterns, url +from django.conf.urls import patterns, url urlpatterns = patterns("symposion.reviews.views", diff --git a/symposion/schedule/models.py b/symposion/schedule/models.py index a47afb9d..5954e07e 100644 --- a/symposion/schedule/models.py +++ b/symposion/schedule/models.py @@ -80,8 +80,9 @@ class Slot(models.Model): Unassign the associated content with this slot. """ if self.content and self.content.slot_id: - self.content.slot = None - self.content.save() + presentation = self.content + presentation.slot = None + presentation.save() @property def content(self): diff --git a/symposion/schedule/urls.py b/symposion/schedule/urls.py index 94acd3e1..b6cd1630 100644 --- a/symposion/schedule/urls.py +++ b/symposion/schedule/urls.py @@ -1,5 +1,5 @@ -# flake8: noqa -from django.conf.urls.defaults import url, patterns +from django.conf.urls import url, patterns + urlpatterns = patterns("symposion.schedule.views", url(r"^$", "schedule_conference", name="schedule_conference"), diff --git a/symposion/speakers/urls.py b/symposion/speakers/urls.py index 0d1c7b13..fb30e787 100644 --- a/symposion/speakers/urls.py +++ b/symposion/speakers/urls.py @@ -1,5 +1,4 @@ -# flake8: noqa -from django.conf.urls.defaults import * +from django.conf.urls import patterns, url urlpatterns = patterns("symposion.speakers.views", diff --git a/symposion/sponsorship/urls.py b/symposion/sponsorship/urls.py index e6ba5fa3..c7dc581c 100644 --- a/symposion/sponsorship/urls.py +++ b/symposion/sponsorship/urls.py @@ -1,10 +1,9 @@ -# flake8: noqa -from django.conf.urls.defaults import patterns, url -from django.views.generic.simple import direct_to_template +from django.conf.urls import patterns, url +from django.views.generic import TemplateView urlpatterns = patterns("symposion.sponsorship.views", - url(r"^$", direct_to_template, {"template": "sponsorship/list.html"}, name="sponsor_list"), + url(r"^$", TemplateView.as_view(template_name="sponsorship/list.html"), name="sponsor_list"), url(r"^apply/$", "sponsor_apply", name="sponsor_apply"), url(r"^add/$", "sponsor_add", name="sponsor_add"), url(r"^(?P\d+)/$", "sponsor_detail", name="sponsor_detail"), diff --git a/symposion/teams/urls.py b/symposion/teams/urls.py index d70a600d..785c4300 100644 --- a/symposion/teams/urls.py +++ b/symposion/teams/urls.py @@ -1,5 +1,4 @@ -# flake8: noqa -from django.conf.urls.defaults import * +from django.conf.urls import patterns, url urlpatterns = patterns("symposion.teams.views",