UPD: small steps to become python3 compatible.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
from __future__ import unicode_literals
|
||||
from django.conf import settings
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
|
||||
from ..utils import get_ghost_user, get_system_user
|
||||
|
||||
@@ -9,6 +11,7 @@ def get_system_user_id():
|
||||
return get_system_user().id
|
||||
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class EventFlag(models.Model):
|
||||
event = models.ForeignKey('dav_events.Event', related_name='flags')
|
||||
status = models.ForeignKey('dav_events.EventStatus',
|
||||
@@ -23,9 +26,9 @@ class EventFlag(models.Model):
|
||||
class Meta:
|
||||
ordering = ['event', 'timestamp', 'status']
|
||||
|
||||
def __unicode__(self):
|
||||
s = u'{status} - {timestamp}'
|
||||
def __str__(self):
|
||||
s = '{status} - {timestamp}'
|
||||
if self.user:
|
||||
s += u' by user {user}'
|
||||
s += ' by user {user}'
|
||||
return s.format(status=self.status, timestamp=self.timestamp.strftime('%d.%m.%Y %H:%M:%S'),
|
||||
user=self.user)
|
||||
|
||||
Reference in New Issue
Block a user