Skip to content

Commit

Permalink
Add docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
yakky committed Apr 8, 2016
1 parent a628220 commit fa340fe
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions djangocms_blog/models.py
Expand Up @@ -197,11 +197,17 @@ def __str__(self):
return self.safe_translation_getter('title')

def save(self, *args, **kwargs):
"""
Handle some auto configuration during save
"""
if self.publish and self.date_published is None:
self.date_published = timezone.now()
super(Post, self).save(*args, **kwargs)

def save_translation(self, translation, *args, **kwargs):
"""
Handle some auto configuration during save
"""
if not translation.slug and translation.title:
translation.slug = slugify(translation.title)
super(Post, self).save_translation(translation, *args, **kwargs)
Expand Down

0 comments on commit fa340fe

Please sign in to comment.