Skip to content

Instantly share code, notes, and snippets.

@jeffmarshall
Created February 27, 2013 00:56
Show Gist options
  • Save jeffmarshall/5043913 to your computer and use it in GitHub Desktop.
Save jeffmarshall/5043913 to your computer and use it in GitHub Desktop.
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