Skip to content
Snippets Groups Projects
Commit 7c860dff authored by Dylann Cordel's avatar Dylann Cordel :crossed_swords:
Browse files

fix python errors

parent 18f3aa4e
No related branches found
No related tags found
No related merge requests found
......@@ -242,10 +242,11 @@ class NewsboxBase(six.with_metaclass(NewsboxModelBase, models.Model)):
if not self.newsbox_published:
self.newsbox_published = True
updated = True
now_datetime = now()
if now_datetime < self.newsbox_publication_start_date:
self.newsbox_publication_start_date = now_datetime
updated = True
if self.newsbox_publication_start_date:
now_datetime = now()
if now_datetime < self.newsbox_publication_start_date:
self.newsbox_publication_start_date = now_datetime
updated = True
if updated and commit:
self.save()
return updated
......@@ -306,10 +307,10 @@ class NewsboxExpiredBase(six.with_metaclass(NewsboxModelBase, models.Model)):
def publish(self, commit=True):
updated = super(NewsboxExpiredBase, self).publish(commit=False)
now_datetime = now()
if now_datetime > self.newsbox_publication_end_date:
self.newsbox_publication_end_date = None
updated = True
if self.newsbox_publication_end_date:
if now() > self.newsbox_publication_end_date:
self.newsbox_publication_end_date = None
updated = True
if updated and commit:
self.save()
return updated
......
......@@ -63,7 +63,7 @@ def CustomModelCMSAdminFactory(
"""
output = ''
edit_url = reverse(
'admin:%s_%s_change' % (obj._meta.app_label, obj._meta.module_name),
'admin:%s_%s_change' % (obj._meta.app_label, obj._meta.model_name),
args=[obj.pk])
show_url = None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment