UPD: small steps to become python3 compatible.
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
from django.db import models
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from ..validators import IdStringValidator
|
||||
@@ -13,6 +15,7 @@ BOOTSTRAP_CONTEXT_CHOICES = (
|
||||
)
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class EventStatus(models.Model):
|
||||
code = models.CharField(primary_key=True, max_length=254, validators=[IdStringValidator])
|
||||
severity = models.IntegerField(unique=True)
|
||||
@@ -20,14 +23,14 @@ class EventStatus(models.Model):
|
||||
bootstrap_context = models.CharField(max_length=20, blank=True, choices=BOOTSTRAP_CONTEXT_CHOICES)
|
||||
|
||||
class Meta:
|
||||
verbose_name = _(u'Veranstaltungsstatus')
|
||||
verbose_name_plural = _(u'Veranstaltungsstati')
|
||||
verbose_name = _('Veranstaltungsstatus')
|
||||
verbose_name_plural = _('Veranstaltungsstati')
|
||||
ordering = ['severity']
|
||||
|
||||
def __unicode__(self):
|
||||
return u'{severity} - {code} ({label})'.format(code=self.code,
|
||||
severity=self.severity,
|
||||
label=self.label)
|
||||
def __str__(self):
|
||||
return '{severity} - {code} ({label})'.format(code=self.code,
|
||||
severity=self.severity,
|
||||
label=self.label)
|
||||
|
||||
|
||||
def get_or_create_event_status(code):
|
||||
|
||||
Reference in New Issue
Block a user