Skip to content
Permalink
Browse files

Small fix

  • Loading branch information...
Depado committed May 13, 2015
1 parent 870cd0f commit 253fca52f5cc2862460a3c95cadd32e96cc857d6
Showing with 4 additions and 0 deletions.
  1. +3 −0 app/models/post.py
  2. +1 −0 app/views/post.py
@@ -23,6 +23,9 @@ class Post(db.Model):
def __init__(self, **kwargs):
super(Post, self).__init__(**kwargs)
self.pub_date = self.pub_date if self.pub_date is not None else datetime.utcnow()
self.set_title_slug()

def set_title_slug(self):
self.title_slug = slugify("{date}-{title}".format(date=str(self.pub_date.date()), title=self.title))

def save(self):
@@ -44,6 +44,7 @@ def edit(post_id):

post.title = form.title.data
post.content = form.content.data
post.set_title_slug()
saved = post.save()
if saved:
flash("Successfully saved the post.")

0 comments on commit 253fca5

Please sign in to comment.
You can’t perform that action at this time.