X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/ae60b2a3949e96357477cc04f90fd0873cee8a92..65e46c7561ac8603cfc0fe0a848209e567df3daa:/src/picture/models.py diff --git a/src/picture/models.py b/src/picture/models.py index 8ab5d2111..dc7142c0a 100644 --- a/src/picture/models.py +++ b/src/picture/models.py @@ -101,7 +101,7 @@ class Picture(models.Model): pass class Meta: - ordering = ('sort_key',) + ordering = ('sort_key_author', 'sort_key') verbose_name = _('picture') verbose_name_plural = _('pictures') @@ -127,6 +127,12 @@ class Picture(models.Model): def author_str(self): return ", ".join(str(t) for t in self.tags.filter(category='author')) + def tag_unicode(self, category): + return ", ".join(unicode(t) for t in self.tags.filter(category=category)) + + def author_unicode(self): + return self.tag_unicode('author') + @permalink def get_absolute_url(self): return 'picture.views.picture_detail', [self.slug]