BROKEN! MIGRATE! BIG UPD: not yet complete support for publish[ed|ing]_[web|facebook]

This commit is contained in:
2019-01-23 18:36:11 +01:00
parent 7f7b596b20
commit e6a5f9818a
19 changed files with 503 additions and 210 deletions

View File

@@ -2,7 +2,7 @@
from django.db import models
from django.utils.translation import ugettext_lazy as _
from ..validators import LowerAlphanumericValidator
from ..validators import IdStringValidator
BOOTSTRAP_CONTEXT_CHOICES = (
('default', 'default'),
@@ -17,7 +17,11 @@ DEFAULT_EVENT_STATI = {
'draft': (10, _(u'Entwurf'), 'info'),
'submitted': (30, _(u'Eingereicht'), 'danger'),
'accepted': (50, _(u'Freigegeben'), 'warning'),
'publishing_facebook': (68, _(u'Veröffentlichung Facebook'), 'warning'),
'publishing_web': (69, _(u'Veröffentlichung Web'), 'warning'),
'publishing': (70, _(u'Veröffentlichung'), 'warning'),
'published_facebook': (78, _(u'Veröffentlicht Facebook'), 'success'),
'published_web': (79, _(u'Veröffentlicht Web'), 'success'),
'published': (80, _(u'Veröffentlicht'), 'success'),
'expired': (100, _(u'Ausgelaufen'), None),
}
@@ -39,7 +43,7 @@ def get_event_status(code):
class EventStatus(models.Model):
code = models.CharField(primary_key=True, max_length=254, validators=[LowerAlphanumericValidator])
code = models.CharField(primary_key=True, max_length=254, validators=[IdStringValidator])
severity = models.IntegerField(unique=True)
label = models.CharField(unique=True, max_length=254)
bootstrap_context = models.CharField(max_length=20, blank=True, choices=BOOTSTRAP_CONTEXT_CHOICES)
@@ -50,9 +54,9 @@ class EventStatus(models.Model):
ordering = ['severity']
def __unicode__(self):
return u'{label} ({severity} {code})'.format(code=self.code,
severity=self.severity,
label=self.label)
return u'{label} ({severity} - {code})'.format(code=self.code,
severity=self.severity,
label=self.label)
def get_bootstrap_label(self):
context = self.bootstrap_context or 'default'