fef-questionnaire/questionnaire/page/models.py

23 lines
624 B
Python
Raw Permalink Normal View History

from django.db import models
from django.urls import reverse
from transmeta import TransMeta
2020-02-13 03:39:27 +00:00
class Page(models.Model, metaclass=TransMeta):
slug = models.SlugField(unique=True, primary_key=True)
title = models.CharField(u"Title", max_length=256)
body = models.TextField(u"Body")
public = models.BooleanField(default=True)
def __unicode__(self):
return u"Page[%s]" % self.slug
2020-02-12 19:12:14 +00:00
__str__ = __unicode__
def get_absolute_url(self):
return reverse('questionnaire.page.views.page', kwargs={'page_to_render':self.slug})
class Meta:
translate = ('title','body',)