#
from django.db import models
from django.contrib.sites.models import Site
+from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _
from django.conf import settings
return self.get_absolute_url()
+@python_2_unicode_compatible
class Result(models.Model):
quiz = models.ForeignKey(Quiz)
slug = models.SlugField(db_index=True)
verbose_name_plural = _('results')
ordering = ['quiz', 'title']
- def __unicode__(self):
+ def __str__(self):
return self.title
@models.permalink
return ('quiz_result', [self.slug])
+@python_2_unicode_compatible
class Question(models.Model):
quiz = models.ForeignKey(Quiz)
slug = models.SlugField(db_index=True)
ordering = ['quiz', 'ordering']
unique_together = [['quiz', 'slug'], ['quiz', 'ordering']]
- def __unicode__(self):
+ def __str__(self):
return self.title
@models.permalink
return self.quiz.where_to()
-
+@python_2_unicode_compatible
class Answer(models.Model):
title = models.CharField(max_length=255)
question = models.ForeignKey(Question)
verbose_name_plural = _('answers')
ordering = ['question', 'ordering']
- def __unicode__(self):
+ def __str__(self):
return self.title
def where_to(self):