Django 1.6 compatibility

This commit is contained in:
Martin Brochhaus 2014-01-11 14:50:04 +08:00
parent d9ba22d6b6
commit 5c07d3e945
11 changed files with 25 additions and 22 deletions

View file

@ -1,6 +1,6 @@
from django.conf.urls.defaults import url, patterns
from django.conf.urls import url, patterns
urlpatterns = patterns("symposion.boxes.views",
url(r"^([-\w]+)/edit/$", "box_edit", name="box_edit"),
)
)

View file

@ -1,4 +1,4 @@
from django.conf.urls.defaults import url, patterns
from django.conf.urls import url, patterns
PAGE_RE = r"(([\w-]{1,})(/[\w-]{1,})*)/"

View file

@ -1,4 +1,4 @@
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url
urlpatterns = patterns("symposion.conference.views",

View file

@ -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
@ -96,7 +94,7 @@ class ProposalBase(models.Model):
help_text=_("Anything else you'd like the program committee to know when making their selection: your past experience, etc. This is not made public. Edit using <a href='http://daringfireball.net/projects/markdown/basics' target='_blank'>Markdown</a>.")
)
submitted = models.DateTimeField(
default=datetime.datetime.now,
default=now,
editable=False,
)
speaker = models.ForeignKey("speakers.Speaker", related_name="proposals")
@ -166,7 +164,7 @@ 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)

View file

@ -1,4 +1,4 @@
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url
urlpatterns = patterns("symposion.proposals.views",

View file

@ -6,7 +6,12 @@ from django.core.exceptions import ObjectDoesNotExist
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

View file

@ -1,4 +1,4 @@
from django.conf.urls.defaults import patterns, url
from django.conf.urls import patterns, url
urlpatterns = patterns("symposion.reviews.views",

View file

@ -1,4 +1,4 @@
from django.conf.urls.defaults import url, patterns
from django.conf.urls import url, patterns
urlpatterns = patterns("symposion.schedule.views",

View file

@ -1,4 +1,4 @@
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url
urlpatterns = patterns("symposion.speakers.views",

View file

@ -1,9 +1,9 @@
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<pk>\d+)/$", "sponsor_detail", name="sponsor_detail"),

View file

@ -1,4 +1,4 @@
from django.conf.urls.defaults import *
from django.conf.urls import patterns, url
urlpatterns = patterns("symposion.teams.views",