python3 compatibility
- Things are suggested in python3 porting guide. https://docs.djangoproject.com/en/1.8/topics/python3/ 1. adding ```from django.utils.encoding import python_2_unicode_compatible``` 2. ``` __str__``` instead of ```__unicode__``` https://docs.djangoproject.com/en/1.8/topics/python3/#str-and-unicode-methods 3. Adding ```from __future__ import unicode_literals``` at the top of your Python modules https://docs.djangoproject.com/en/1.8/topics/python3/#unicode-literals 4. Removing the `u` prefix before unicode strings; https://docs.djangoproject.com/en/1.8/topics/python3/#unicode-literals - also closed #66 Signed-off-by: Hiroshi Miura <miurahr@linux.com>
This commit is contained in:
parent
f7caf14357
commit
a95825ede8
36 changed files with 110 additions and 38 deletions
|
@ -1,11 +1,14 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
|
|
||||||
import reversion
|
import reversion
|
||||||
|
|
||||||
from markitup.fields import MarkupField
|
from markitup.fields import MarkupField
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class Box(models.Model):
|
class Box(models.Model):
|
||||||
|
|
||||||
label = models.CharField(max_length=100, db_index=True)
|
label = models.CharField(max_length=100, db_index=True)
|
||||||
|
@ -14,7 +17,7 @@ class Box(models.Model):
|
||||||
created_by = models.ForeignKey(User, related_name="boxes")
|
created_by = models.ForeignKey(User, related_name="boxes")
|
||||||
last_updated_by = models.ForeignKey(User, related_name="updated_boxes")
|
last_updated_by = models.ForeignKey(User, related_name="updated_boxes")
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return self.label
|
return self.label
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -6,6 +6,7 @@ from django.conf import settings
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from markitup.fields import MarkupField
|
from markitup.fields import MarkupField
|
||||||
|
@ -17,6 +18,7 @@ import reversion
|
||||||
from .managers import PublishedPageManager
|
from .managers import PublishedPageManager
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class Page(models.Model):
|
class Page(models.Model):
|
||||||
|
|
||||||
STATUS_CHOICES = (
|
STATUS_CHOICES = (
|
||||||
|
@ -35,7 +37,7 @@ class Page(models.Model):
|
||||||
|
|
||||||
published = PublishedPageManager()
|
published = PublishedPageManager()
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return self.title
|
return self.title
|
||||||
|
|
||||||
@models.permalink
|
@models.permalink
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
|
|
||||||
from timezones.fields import TimeZoneField
|
from timezones.fields import TimeZoneField
|
||||||
|
|
||||||
|
@ -7,6 +9,7 @@ from timezones.fields import TimeZoneField
|
||||||
CONFERENCE_CACHE = {}
|
CONFERENCE_CACHE = {}
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class Conference(models.Model):
|
class Conference(models.Model):
|
||||||
"""
|
"""
|
||||||
the full conference for a specific year, e.g. US PyCon 2012.
|
the full conference for a specific year, e.g. US PyCon 2012.
|
||||||
|
@ -21,7 +24,7 @@ class Conference(models.Model):
|
||||||
# timezone the conference is in
|
# timezone the conference is in
|
||||||
timezone = TimeZoneField(_("timezone"), blank=True)
|
timezone = TimeZoneField(_("timezone"), blank=True)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return self.title
|
return self.title
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
|
@ -42,6 +45,7 @@ class Conference(models.Model):
|
||||||
verbose_name_plural = _("conferences")
|
verbose_name_plural = _("conferences")
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class Section(models.Model):
|
class Section(models.Model):
|
||||||
"""
|
"""
|
||||||
a section of the conference such as "Tutorials", "Workshops",
|
a section of the conference such as "Tutorials", "Workshops",
|
||||||
|
@ -58,8 +62,8 @@ class Section(models.Model):
|
||||||
start_date = models.DateField(_("start date"), null=True, blank=True)
|
start_date = models.DateField(_("start date"), null=True, blank=True)
|
||||||
end_date = models.DateField(_("end date"), null=True, blank=True)
|
end_date = models.DateField(_("end date"), null=True, blank=True)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return u"%s %s" % (self.conference, self.name)
|
return "%s %s" % (self.conference, self.name)
|
||||||
|
|
||||||
class Meta(object):
|
class Meta(object):
|
||||||
verbose_name = _("section")
|
verbose_name = _("section")
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from html5lib import html5parser, sanitizer
|
from html5lib import html5parser, sanitizer
|
||||||
|
|
||||||
import markdown
|
import markdown
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
import csv
|
import csv
|
||||||
|
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
import os
|
import os
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models import Q
|
from django.db.models import Q
|
||||||
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.utils.timezone import now
|
from django.utils.timezone import now
|
||||||
|
|
||||||
|
@ -21,6 +23,7 @@ from symposion.conference.models import Section
|
||||||
from symposion.speakers.models import Speaker
|
from symposion.speakers.models import Speaker
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class ProposalSection(models.Model):
|
class ProposalSection(models.Model):
|
||||||
"""
|
"""
|
||||||
configuration of proposal submissions for a specific Section.
|
configuration of proposal submissions for a specific Section.
|
||||||
|
@ -55,10 +58,11 @@ class ProposalSection(models.Model):
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return self.section.name
|
return self.section.name
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class ProposalKind(models.Model):
|
class ProposalKind(models.Model):
|
||||||
"""
|
"""
|
||||||
e.g. talk vs panel vs tutorial vs poster
|
e.g. talk vs panel vs tutorial vs poster
|
||||||
|
@ -72,10 +76,11 @@ class ProposalKind(models.Model):
|
||||||
name = models.CharField(_("Name"), max_length=100)
|
name = models.CharField(_("Name"), max_length=100)
|
||||||
slug = models.SlugField()
|
slug = models.SlugField()
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class ProposalBase(models.Model):
|
class ProposalBase(models.Model):
|
||||||
|
|
||||||
objects = InheritanceManager()
|
objects = InheritanceManager()
|
||||||
|
@ -155,9 +160,13 @@ class ProposalBase(models.Model):
|
||||||
"kind": self.kind.name,
|
"kind": self.kind.name,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def __str__(self):
|
||||||
|
return self.title
|
||||||
|
|
||||||
reversion.register(ProposalBase)
|
reversion.register(ProposalBase)
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class AdditionalSpeaker(models.Model):
|
class AdditionalSpeaker(models.Model):
|
||||||
|
|
||||||
SPEAKING_STATUS_PENDING = 1
|
SPEAKING_STATUS_PENDING = 1
|
||||||
|
@ -177,7 +186,7 @@ class AdditionalSpeaker(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = ("speaker", "proposalbase")
|
unique_together = ("speaker", "proposalbase")
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
if self.status is self.SPEAKING_STATUS_PENDING:
|
if self.status is self.SPEAKING_STATUS_PENDING:
|
||||||
return _(u"pending speaker (%s)") % self.speaker.email
|
return _(u"pending speaker (%s)") % self.speaker.email
|
||||||
elif self.status is self.SPEAKING_STATUS_DECLINED:
|
elif self.status is self.SPEAKING_STATUS_DECLINED:
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
import hashlib
|
import hashlib
|
||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
from markitup.widgets import MarkItUpWidget
|
from markitup.widgets import MarkItUpWidget
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from __future__ import unicode_literals
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
|
@ -27,8 +28,8 @@ class ProposalScoreExpression(object):
|
||||||
class Votes(object):
|
class Votes(object):
|
||||||
PLUS_ONE = "+1"
|
PLUS_ONE = "+1"
|
||||||
PLUS_ZERO = "+0"
|
PLUS_ZERO = "+0"
|
||||||
MINUS_ZERO = u"−0"
|
MINUS_ZERO = "−0"
|
||||||
MINUS_ONE = u"−1"
|
MINUS_ONE = "−1"
|
||||||
|
|
||||||
CHOICES = [
|
CHOICES = [
|
||||||
(PLUS_ONE, u"+1 — Good proposal and I will argue for it to be accepted."),
|
(PLUS_ONE, u"+1 — Good proposal and I will argue for it to be accepted."),
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
|
||||||
def has_permission(user, proposal, speaker=False, reviewer=False):
|
def has_permission(user, proposal, speaker=False, reviewer=False):
|
||||||
"""
|
"""
|
||||||
Returns whether or not ther user has permission to review this proposal,
|
Returns whether or not ther user has permission to review this proposal,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from symposion.schedule.models import Schedule, Day, Room, SlotKind, Slot, SlotRoom, Presentation, Session, SessionRole
|
from symposion.schedule.models import Schedule, Day, Room, SlotKind, Slot, SlotRoom, Presentation, Session, SessionRole
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
import csv
|
import csv
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
This file contains functions that are useful to humans at the shell for
|
This file contains functions that are useful to humans at the shell for
|
||||||
manipulating the database in more natural ways.
|
manipulating the database in more natural ways.
|
||||||
"""
|
"""
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
|
|
||||||
from .models import Schedule, Day, Room, Slot, SlotKind, SlotRoom
|
from .models import Schedule, Day, Room, Slot, SlotKind, SlotRoom
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
|
|
||||||
from markitup.fields import MarkupField
|
from markitup.fields import MarkupField
|
||||||
|
|
||||||
|
@ -11,42 +13,46 @@ from symposion.conference.models import Section
|
||||||
from symposion.speakers.models import Speaker
|
from symposion.speakers.models import Speaker
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class Schedule(models.Model):
|
class Schedule(models.Model):
|
||||||
|
|
||||||
section = models.OneToOneField(Section)
|
section = models.OneToOneField(Section)
|
||||||
published = models.BooleanField(default=True)
|
published = models.BooleanField(default=True)
|
||||||
hidden = models.BooleanField("Hide schedule from overall conference view", default=False)
|
hidden = models.BooleanField("Hide schedule from overall conference view", default=False)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return u"%s Schedule" % self.section
|
return "%s Schedule" % self.section
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ["section"]
|
ordering = ["section"]
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class Day(models.Model):
|
class Day(models.Model):
|
||||||
|
|
||||||
schedule = models.ForeignKey(Schedule)
|
schedule = models.ForeignKey(Schedule)
|
||||||
date = models.DateField()
|
date = models.DateField()
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return u"%s" % self.date
|
return "%s" % self.date
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = [("schedule", "date")]
|
unique_together = [("schedule", "date")]
|
||||||
ordering = ["date"]
|
ordering = ["date"]
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class Room(models.Model):
|
class Room(models.Model):
|
||||||
|
|
||||||
schedule = models.ForeignKey(Schedule)
|
schedule = models.ForeignKey(Schedule)
|
||||||
name = models.CharField(max_length=65)
|
name = models.CharField(max_length=65)
|
||||||
order = models.PositiveIntegerField()
|
order = models.PositiveIntegerField()
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class SlotKind(models.Model):
|
class SlotKind(models.Model):
|
||||||
"""
|
"""
|
||||||
A slot kind represents what kind a slot is. For example, a slot can be a
|
A slot kind represents what kind a slot is. For example, a slot can be a
|
||||||
|
@ -56,10 +62,11 @@ class SlotKind(models.Model):
|
||||||
schedule = models.ForeignKey(Schedule)
|
schedule = models.ForeignKey(Schedule)
|
||||||
label = models.CharField(max_length=50)
|
label = models.CharField(max_length=50)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return self.label
|
return self.label
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class Slot(models.Model):
|
class Slot(models.Model):
|
||||||
|
|
||||||
day = models.ForeignKey(Day)
|
day = models.ForeignKey(Day)
|
||||||
|
@ -124,14 +131,15 @@ class Slot(models.Model):
|
||||||
def rooms(self):
|
def rooms(self):
|
||||||
return Room.objects.filter(pk__in=self.slotroom_set.values("room"))
|
return Room.objects.filter(pk__in=self.slotroom_set.values("room"))
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
roomlist = ' '.join(map(lambda r: r.__unicode__(), self.rooms))
|
roomlist = ' '.join(map(lambda r: r.__unicode__(), self.rooms))
|
||||||
return u"%s %s (%s - %s) %s" % (self.day, self.kind, self.start, self.end, roomlist)
|
return "%s %s (%s - %s) %s" % (self.day, self.kind, self.start, self.end, roomlist)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ["day", "start", "end"]
|
ordering = ["day", "start", "end"]
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class SlotRoom(models.Model):
|
class SlotRoom(models.Model):
|
||||||
"""
|
"""
|
||||||
Links a slot with a room.
|
Links a slot with a room.
|
||||||
|
@ -140,14 +148,15 @@ class SlotRoom(models.Model):
|
||||||
slot = models.ForeignKey(Slot)
|
slot = models.ForeignKey(Slot)
|
||||||
room = models.ForeignKey(Room)
|
room = models.ForeignKey(Room)
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return u"%s %s" % (self.room, self.slot)
|
return "%s %s" % (self.room, self.slot)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = [("slot", "room")]
|
unique_together = [("slot", "room")]
|
||||||
ordering = ["slot", "room__order"]
|
ordering = ["slot", "room__order"]
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class Presentation(models.Model):
|
class Presentation(models.Model):
|
||||||
|
|
||||||
slot = models.OneToOneField(Slot, null=True, blank=True, related_name="content_ptr")
|
slot = models.OneToOneField(Slot, null=True, blank=True, related_name="content_ptr")
|
||||||
|
@ -177,13 +186,14 @@ class Presentation(models.Model):
|
||||||
if speaker.user:
|
if speaker.user:
|
||||||
yield speaker
|
yield speaker
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return u"#%s %s (%s)" % (self.number, self.title, self.speaker)
|
return "#%s %s (%s)" % (self.number, self.title, self.speaker)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ["slot"]
|
ordering = ["slot"]
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class Session(models.Model):
|
class Session(models.Model):
|
||||||
|
|
||||||
day = models.ForeignKey(Day, related_name="sessions")
|
day = models.ForeignKey(Day, related_name="sessions")
|
||||||
|
@ -206,18 +216,19 @@ class Session(models.Model):
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
start = self.start()
|
start = self.start()
|
||||||
end = self.end()
|
end = self.end()
|
||||||
if start and end:
|
if start and end:
|
||||||
return u"%s: %s - %s" % (
|
return "%s: %s - %s" % (
|
||||||
self.day.date.strftime("%a"),
|
self.day.date.strftime("%a"),
|
||||||
start.strftime("%X"),
|
start.strftime("%X"),
|
||||||
end.strftime("%X")
|
end.strftime("%X")
|
||||||
)
|
)
|
||||||
return u""
|
return ""
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class SessionRole(models.Model):
|
class SessionRole(models.Model):
|
||||||
|
|
||||||
SESSION_ROLE_CHAIR = 1
|
SESSION_ROLE_CHAIR = 1
|
||||||
|
@ -238,6 +249,6 @@ class SessionRole(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
unique_together = [("session", "user", "role")]
|
unique_together = [("session", "user", "role")]
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return u"%s %s: %s" % (self.user, self.session,
|
return "%s %s: %s" % (self.user, self.session,
|
||||||
self.SESSION_ROLE_TYPES[self.role - 1][1])
|
self.SESSION_ROLE_TYPES[self.role - 1][1])
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
import itertools
|
import itertools
|
||||||
|
|
||||||
from django.db.models import Count, Min
|
from django.db.models import Count, Min
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django.conf.urls import url, patterns
|
from django.conf.urls import url, patterns
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
|
||||||
from symposion.speakers.models import Speaker
|
from symposion.speakers.models import Speaker
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django.apps import AppConfig
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
from markitup.widgets import MarkItUpWidget
|
from markitup.widgets import MarkItUpWidget
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
import datetime
|
import datetime
|
||||||
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
|
@ -8,6 +10,7 @@ from django.contrib.auth.models import User
|
||||||
from markitup.fields import MarkupField
|
from markitup.fields import MarkupField
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class Speaker(models.Model):
|
class Speaker(models.Model):
|
||||||
|
|
||||||
SESSION_COUNT_CHOICES = [
|
SESSION_COUNT_CHOICES = [
|
||||||
|
@ -34,11 +37,11 @@ class Speaker(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ['name']
|
ordering = ['name']
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
if self.user:
|
if self.user:
|
||||||
return self.name
|
return self.name
|
||||||
else:
|
else:
|
||||||
return u"?"
|
return "?"
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return reverse("speaker_edit")
|
return reverse("speaker_edit")
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django.conf.urls import patterns, url
|
from django.conf.urls import patterns, url
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.http import Http404
|
from django.http import Http404
|
||||||
from django.shortcuts import render, redirect, get_object_or_404
|
from django.shortcuts import render, redirect, get_object_or_404
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.forms.models import inlineformset_factory, BaseInlineFormSet
|
from django.forms.models import inlineformset_factory, BaseInlineFormSet
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
@ -5,6 +6,7 @@ from django.core.exceptions import ValidationError
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models.signals import post_init, post_save
|
from django.db.models.signals import post_init, post_save
|
||||||
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
from django.contrib.auth.models import User
|
from django.contrib.auth.models import User
|
||||||
|
@ -14,6 +16,7 @@ from symposion.conference.models import Conference
|
||||||
from symposion.sponsorship.managers import SponsorManager
|
from symposion.sponsorship.managers import SponsorManager
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class SponsorLevel(models.Model):
|
class SponsorLevel(models.Model):
|
||||||
|
|
||||||
conference = models.ForeignKey(Conference, verbose_name=_("conference"))
|
conference = models.ForeignKey(Conference, verbose_name=_("conference"))
|
||||||
|
@ -27,13 +30,14 @@ class SponsorLevel(models.Model):
|
||||||
verbose_name = _("sponsor level")
|
verbose_name = _("sponsor level")
|
||||||
verbose_name_plural = _("sponsor levels")
|
verbose_name_plural = _("sponsor levels")
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
def sponsors(self):
|
def sponsors(self):
|
||||||
return self.sponsor_set.filter(active=True).order_by("added")
|
return self.sponsor_set.filter(active=True).order_by("added")
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class Sponsor(models.Model):
|
class Sponsor(models.Model):
|
||||||
|
|
||||||
applicant = models.ForeignKey(User, related_name="sponsorships", verbose_name=_("applicant"),
|
applicant = models.ForeignKey(User, related_name="sponsorships", verbose_name=_("applicant"),
|
||||||
|
@ -55,7 +59,7 @@ class Sponsor(models.Model):
|
||||||
|
|
||||||
objects = SponsorManager()
|
objects = SponsorManager()
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -166,6 +170,7 @@ CONTENT_TYPE_CHOICES = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class Benefit(models.Model):
|
class Benefit(models.Model):
|
||||||
|
|
||||||
name = models.CharField(_("name"), max_length=100)
|
name = models.CharField(_("name"), max_length=100)
|
||||||
|
@ -175,10 +180,11 @@ class Benefit(models.Model):
|
||||||
content_type = models.CharField(_("content type"), choices=CONTENT_TYPE_CHOICES,
|
content_type = models.CharField(_("content type"), choices=CONTENT_TYPE_CHOICES,
|
||||||
max_length=20, default="simple")
|
max_length=20, default="simple")
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class BenefitLevel(models.Model):
|
class BenefitLevel(models.Model):
|
||||||
|
|
||||||
benefit = models.ForeignKey(Benefit, related_name="benefit_levels", verbose_name=_("benefit"))
|
benefit = models.ForeignKey(Benefit, related_name="benefit_levels", verbose_name=_("benefit"))
|
||||||
|
@ -191,10 +197,11 @@ class BenefitLevel(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ["level"]
|
ordering = ["level"]
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return u"%s - %s" % (self.level, self.benefit)
|
return "%s - %s" % (self.level, self.benefit)
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class SponsorBenefit(models.Model):
|
class SponsorBenefit(models.Model):
|
||||||
|
|
||||||
sponsor = models.ForeignKey(Sponsor, related_name="sponsor_benefits", verbose_name=_("sponsor"))
|
sponsor = models.ForeignKey(Sponsor, related_name="sponsor_benefits", verbose_name=_("sponsor"))
|
||||||
|
@ -213,8 +220,8 @@ class SponsorBenefit(models.Model):
|
||||||
class Meta:
|
class Meta:
|
||||||
ordering = ["-active"]
|
ordering = ["-active"]
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return u"%s - %s" % (self.sponsor, self.benefit)
|
return "%s - %s" % (self.sponsor, self.benefit)
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
num_words = len(self.text.split())
|
num_words = len(self.text.split())
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from cStringIO import StringIO
|
from cStringIO import StringIO
|
||||||
import itertools
|
import itertools
|
||||||
import logging
|
import logging
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django import forms
|
from django import forms
|
||||||
|
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
from django.db import models
|
from django.db import models
|
||||||
|
@ -5,6 +6,7 @@ from django.db import models
|
||||||
import reversion
|
import reversion
|
||||||
|
|
||||||
from django.contrib.auth.models import Permission, User
|
from django.contrib.auth.models import Permission, User
|
||||||
|
from django.utils.encoding import python_2_unicode_compatible
|
||||||
|
|
||||||
|
|
||||||
TEAM_ACCESS_CHOICES = [
|
TEAM_ACCESS_CHOICES = [
|
||||||
|
@ -14,6 +16,7 @@ TEAM_ACCESS_CHOICES = [
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@python_2_unicode_compatible
|
||||||
class Team(models.Model):
|
class Team(models.Model):
|
||||||
|
|
||||||
slug = models.SlugField(unique=True)
|
slug = models.SlugField(unique=True)
|
||||||
|
@ -34,7 +37,7 @@ class Team(models.Model):
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return ("team_detail", [self.slug])
|
return ("team_detail", [self.slug])
|
||||||
|
|
||||||
def __unicode__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
def get_state_for_user(self, user):
|
def get_state_for_user(self, user):
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
from django.http import Http404, HttpResponseNotAllowed
|
from django.http import Http404, HttpResponseNotAllowed
|
||||||
from django.shortcuts import render, redirect, get_object_or_404
|
from django.shortcuts import render, redirect, get_object_or_404
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import unicode_literals
|
||||||
import hashlib
|
import hashlib
|
||||||
import random
|
import random
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue