From 76f56b2aa3a39a1063a7ffa0071df169f85a5bdf Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Wed, 31 Oct 2012 10:00:35 +0100 Subject: [PATCH 1/1] fix saving --- migdal/models.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/migdal/models.py b/migdal/models.py index 028350c..c15432d 100644 --- a/migdal/models.py +++ b/migdal/models.py @@ -60,17 +60,15 @@ class Entry(models.Model): return self.title def save(self, *args, **kwargs): - if self.pk is not None: - orig = type(self).objects.get(pk=self.pk) - published_now = False - for lc, ln in settings.LANGUAGES: - if (getattr(self, "published_%s" % lc) - and getattr(self, "published_at_%s" % lc) is None): - setattr(self, "published_at_%s" % lc, datetime.now()) - published_now = True - if published_now: - self.notify_author_published() + published_now = False + for lc, ln in settings.LANGUAGES: + if (getattr(self, "published_%s" % lc) + and getattr(self, "published_at_%s" % lc) is None): + setattr(self, "published_at_%s" % lc, datetime.now()) + published_now = True super(Entry, self).save(*args, **kwargs) + if published_now: + self.notify_author_published() def clean(self): for lc, ln in settings.LANGUAGES: -- 2.20.1