diff options
author | luxagraf <sng@luxagraf.net> | 2016-05-14 21:52:43 -0400 |
---|---|---|
committer | luxagraf <sng@luxagraf.net> | 2016-05-14 21:52:43 -0400 |
commit | 7945a5a48599677c07aff9740a625a428515eeb4 (patch) | |
tree | 1203bc9e5e33bd6f39d672aec127d265abb0d13e | |
parent | 6e1bbc2482dd43a9b438c73d644d9c684d55457d (diff) |
fixed a bug that looked for pk before it was assigned
-rw-r--r-- | app/jrnl/models.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/jrnl/models.py b/app/jrnl/models.py index abb9729..08d0721 100644 --- a/app/jrnl/models.py +++ b/app/jrnl/models.py @@ -186,10 +186,11 @@ class Entry(models.Model): return self.get_next_by_pub_date(status__exact=1) def save(self): - if self.pk >= 167: - md = render_images(self.body_markdown) - else: - md = image_url_replace(self.body_markdown) + if self.pk: + if self.pk >= 167: + md = render_images(self.body_markdown) + else: + md = image_url_replace(self.body_markdown) self.body_html = markdown.markdown(md, extensions=['extra'], safe_mode=False) self.dek == markdown.markdown(self.dek, safe_mode=False) try: |