From db5e4ec4b6c1faaacbe0c8676b536779e6f22486 Mon Sep 17 00:00:00 2001 From: m-vdb Date: Mon, 12 Feb 2018 20:12:38 +0100 Subject: [PATCH 1/2] fix Template string representation for python3 --- dbtemplates/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dbtemplates/models.py b/dbtemplates/models.py index e459fe3..37b138c 100644 --- a/dbtemplates/models.py +++ b/dbtemplates/models.py @@ -10,8 +10,10 @@ from django.db.models import signals from django.template import TemplateDoesNotExist from django.utils.translation import ugettext_lazy as _ from django.utils.timezone import now +import six +@six.python_2_unicode_compatible class Template(models.Model): """ Defines a template model for use with the database template loader. @@ -36,7 +38,7 @@ class Template(models.Model): verbose_name_plural = _('templates') ordering = ('name',) - def __unicode__(self): + def __str__(self): return self.name def populate(self, name=None): From 16afa4983167f1b55eaffe932a6e535fcdd48949 Mon Sep 17 00:00:00 2001 From: Jannis Leidel Date: Sun, 27 Jan 2019 21:54:57 +0100 Subject: [PATCH 2/2] Use django.utils.six instead of six directly. --- dbtemplates/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dbtemplates/models.py b/dbtemplates/models.py index 37b138c..152bbab 100644 --- a/dbtemplates/models.py +++ b/dbtemplates/models.py @@ -8,12 +8,12 @@ from django.contrib.sites.models import Site from django.db import models from django.db.models import signals from django.template import TemplateDoesNotExist +from django.utils.six import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _ from django.utils.timezone import now -import six -@six.python_2_unicode_compatible +@python_2_unicode_compatible class Template(models.Model): """ Defines a template model for use with the database template loader.