Fix representation of Theme models on Python 3

pull/18/head
Bruno Alla 2017-05-22 18:21:51 +01:00
parent 1865da3477
commit f6c8e84b7b
1 changed files with 5 additions and 3 deletions

View File

@ -1,14 +1,17 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.files import File
from django.db import models
from django.db.models.signals import post_delete, post_save
from django.utils.encoding import python_2_unicode_compatible, force_text
from colorfield.fields import ColorField
import os
@python_2_unicode_compatible
class Theme(models.Model):
@staticmethod
@ -134,9 +137,8 @@ class Theme(models.Model):
verbose_name = 'Theme'
verbose_name_plural = 'Themes'
def __unicode__(self):
return unicode(u'%s' % (self.name, ))
def __str__(self):
return force_text(self.name)
post_delete.connect(Theme.post_delete_handler, sender = Theme)