From: Radek Czajka Date: Wed, 31 Oct 2012 09:00:35 +0000 (+0100) Subject: fix saving X-Git-Url: https://git.mdrn.pl/prawokultury.git/commitdiff_plain/76f56b2aa3a39a1063a7ffa0071df169f85a5bdf?ds=inline;hp=-c fix saving --- 76f56b2aa3a39a1063a7ffa0071df169f85a5bdf 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: