Permalink
Browse files

use python_2_unicode_compatible decorator

  • Loading branch information...
1 parent 595cad0 commit 3516e9529af4228fa951f6d65062615603a2cac4 @Fantomas42 committed Apr 9, 2013
Showing with 9 additions and 3 deletions.
  1. +3 −1 zinnia/models/author.py
  2. +3 −1 zinnia/models/category.py
  3. +3 −1 zinnia/models_bases/entry.py
View
@@ -1,11 +1,13 @@
"""Author model for Zinnia"""
from django.db import models
from django.contrib.auth import get_user_model
+from django.utils.encoding import python_2_unicode_compatible
from zinnia.managers import entries_published
from zinnia.managers import EntryRelatedPublishedManager
+@python_2_unicode_compatible
class Author(get_user_model()):
"""
Proxy model around :class:`django.contrib.auth.models.get_user_model`.
@@ -27,7 +29,7 @@ def get_absolute_url(self):
"""
return ('zinnia_author_detail', [self.get_username()])
- def __unicode__(self):
+ def __str__(self):
"""
If the user has a full name, use it instead of the username.
"""
@@ -1,6 +1,7 @@
"""Category model for Zinnia"""
from django.db import models
from django.utils.translation import ugettext_lazy as _
+from django.utils.encoding import python_2_unicode_compatible
from mptt.models import MPTTModel
from mptt.models import TreeForeignKey
@@ -10,6 +11,7 @@
from zinnia.managers import EntryRelatedPublishedManager
+@python_2_unicode_compatible
class Category(MPTTModel):
"""
Simple model for categorizing entries.
@@ -60,7 +62,7 @@ def get_absolute_url(self):
"""
return ('zinnia_category_detail', (self.tree_path,))
- def __unicode__(self):
+ def __str__(self):
return self.title
class Meta:
@@ -11,6 +11,7 @@
from django.contrib import comments
from django.contrib.comments.models import CommentFlag
from django.utils.translation import ugettext_lazy as _
+from django.utils.encoding import python_2_unicode_compatible
from django.contrib.markup.templatetags.markup import markdown
from django.contrib.markup.templatetags.markup import textile
@@ -34,6 +35,7 @@
from zinnia.url_shortener import get_url_shortener
+@python_2_unicode_compatible
class CoreEntry(models.Model):
"""
Abstract core entry model class providing
@@ -139,7 +141,7 @@ def get_absolute_url(self):
'day': creation_date.strftime('%d'),
'slug': self.slug})
- def __unicode__(self):
+ def __str__(self):
return '%s: %s' % (self.title, self.get_status_display())
class Meta:

0 comments on commit 3516e95

Please sign in to comment.