use python_2_unicode_compatible
This commit is contained in:
parent
72fdc8ed4d
commit
f0a4aba751
24 changed files with 130 additions and 53 deletions
|
|
@ -21,6 +21,7 @@ from django.conf import settings
|
|||
from django.contrib.auth.models import User, Group
|
||||
from django.db.models.signals import pre_delete
|
||||
from django.utils import datetime_safe
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
|
||||
import ox
|
||||
from oxdjango import fields
|
||||
|
|
@ -158,6 +159,7 @@ def get_poster_path(f, x):
|
|||
def get_torrent_path(f, x):
|
||||
return get_path(f, 'torrent.torrent')
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Item(models.Model):
|
||||
created = models.DateTimeField(auto_now_add=True)
|
||||
modified = models.DateTimeField(auto_now=True)
|
||||
|
|
@ -337,7 +339,7 @@ class Item(models.Model):
|
|||
del c[t]
|
||||
return c
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
year = self.get('year')
|
||||
if year:
|
||||
string = u'%s (%s)' % (ox.decode_html(self.get('title', 'Untitled')), self.get('year'))
|
||||
|
|
@ -1708,6 +1710,7 @@ for key in settings.CONFIG['itemKeys']:
|
|||
if key.get('sortType') == 'person':
|
||||
Item.person_keys.append(key['id'])
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class ItemFind(models.Model):
|
||||
"""
|
||||
used to find items,
|
||||
|
|
@ -1722,7 +1725,7 @@ class ItemFind(models.Model):
|
|||
key = models.CharField(max_length=200, db_index=True)
|
||||
value = models.TextField(blank=True, db_index=settings.DB_GIN_TRGM)
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
return u"%s=%s" % (self.key, self.value)
|
||||
'''
|
||||
ItemSort
|
||||
|
|
@ -1749,6 +1752,7 @@ for key in list(filter(lambda k: k.get('sort', False) or k['type'] in ('integer'
|
|||
ItemSort = type('ItemSort', (models.Model,), attrs)
|
||||
ItemSort.fields = [f.name for f in ItemSort._meta.fields]
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Access(models.Model):
|
||||
class Meta:
|
||||
unique_together = ("item", "user")
|
||||
|
|
@ -1766,11 +1770,12 @@ class Access(models.Model):
|
|||
timesaccessed = Access.objects.filter(item=self.item).aggregate(Sum('accessed'))['accessed__sum']
|
||||
ItemSort.objects.filter(item=self.item).update(timesaccessed=timesaccessed, accessed=self.access)
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
if self.user:
|
||||
return u"%s/%s/%s" % (self.user, self.item, self.access)
|
||||
return u"%s/%s" % (self.item, self.access)
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class Facet(models.Model):
|
||||
'''
|
||||
used for keys that can have multiple values like people, languages etc.
|
||||
|
|
@ -1786,7 +1791,7 @@ class Facet(models.Model):
|
|||
value = models.CharField(max_length=1000, db_index=True)
|
||||
sortvalue = models.CharField(max_length=1000, db_index=True)
|
||||
|
||||
def __unicode__(self):
|
||||
def __str__(self):
|
||||
return u"%s=%s" % (self.key, self.value)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue