fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
newsletter: translation update
[wolnelektury.git]
/
src
/
picture
/
models.py
diff --git
a/src/picture/models.py
b/src/picture/models.py
index
e10d2fa
..
6d8def3
100644
(file)
--- a/
src/picture/models.py
+++ b/
src/picture/models.py
@@
-12,6
+12,8
@@
from django.core.files.storage import FileSystemStorage
from django.utils.datastructures import SortedDict
from fnpdjango.utils.text.slughifi import slughifi
from ssify import flush_ssi_includes
from django.utils.datastructures import SortedDict
from fnpdjango.utils.text.slughifi import slughifi
from ssify import flush_ssi_includes
+
+from catalogue.models.tag import prefetched_relations
from picture import tasks
from StringIO import StringIO
import jsonfield
from picture import tasks
from StringIO import StringIO
import jsonfield
@@
-128,7
+130,11
@@
class Picture(models.Model):
return self.tags.filter(category='author')
def tag_unicode(self, category):
return self.tags.filter(category='author')
def tag_unicode(self, category):
- return ", ".join(self.tags.filter(category=category).values_list('name', flat=True))
+ relations = prefetched_relations(self, category)
+ if relations:
+ return ', '.join(rel.tag.name for rel in relations)
+ else:
+ return ', '.join(self.tags.filter(category=category).values_list('name', flat=True))
def author_unicode(self):
return self.tag_unicode('author')
def author_unicode(self):
return self.tag_unicode('author')