Minor code reorg

This commit is contained in:
Iacopo Spalletti 2016-03-26 01:19:25 +01:00
parent 36af7833af
commit 12f2544ad5

View file

@ -188,6 +188,11 @@ class Post(ModelMeta, TranslatableModel):
def __str__(self):
return self.safe_translation_getter('title')
def save_translation(self, translation, *args, **kwargs):
if not translation.slug and translation.title:
translation.slug = slugify(translation.title)
super(Post, self).save_translation(translation, *args, **kwargs)
def get_absolute_url(self, lang=None):
if not lang:
lang = get_language()
@ -227,11 +232,6 @@ class Post(ModelMeta, TranslatableModel):
data = value
return data
def save_translation(self, translation, *args, **kwargs):
if not translation.slug and translation.title:
translation.slug = slugify(translation.title)
super(Post, self).save_translation(translation, *args, **kwargs)
def get_title(self):
title = self.safe_translation_getter('meta_title', any_language=True)
if not title: