Created
February 27, 2013 00:56
-
-
Save jeffmarshall/5043913 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
from django.utils.translation import ugettext_lazy as _ | |
from hvad.models import TranslatableModel, TranslatedFields | |
class Page(models.Model): | |
slug = models.SlugField() | |
class Meta: | |
verbose_name = _('Page') | |
verbose_name_plural = _('Pages') | |
def __unicode__(self): | |
return " Page: %(slug)s" % {"slug": self.slug} | |
class Text(TranslatableModel): | |
""" | |
translatable text. Meant as a multilingual flatblocks thing. | |
""" | |
slug = models.SlugField() | |
page = models.ForeignKey(Page, blank=True, null=True) | |
translations = TranslatedFields( | |
text = models.TextField() | |
) | |
class Meta: | |
verbose_name = _('Text') | |
verbose_name_plural = _('Texts') | |
def __unicode__(self): | |
return " Text: %(slug)s" % {"slug": self.slug} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment