forked from rc/aircox
fix error on date and cms's signals
This commit is contained in:
parent
087e3614fa
commit
3a4c80e196
|
@ -70,6 +70,7 @@ class Actions:
|
|||
# by schedule;
|
||||
items = schedule.diffusions_of_month(date, exclude_saved = True)
|
||||
count[0] += len(items)
|
||||
print(*[item.date for item in items])
|
||||
|
||||
if manual:
|
||||
Diffusion.objects.bulk_create(items)
|
||||
|
@ -79,7 +80,6 @@ class Actions:
|
|||
if hasattr(item, 'do_not_save'):
|
||||
count[0] -= 1
|
||||
continue
|
||||
|
||||
item.save()
|
||||
saved_items.add(item)
|
||||
|
||||
|
|
|
@ -602,7 +602,9 @@ class Schedule(models.Model):
|
|||
"""
|
||||
Set the time of a datetime to the schedule's one
|
||||
"""
|
||||
return date.replace(hour = self.date.hour, minute = self.date.minute)
|
||||
date = date.replace(hour = self.date.hour, minute = self.date.minute,
|
||||
second = 0)
|
||||
return date if tz.is_aware(date) else tz.make_aware(date)
|
||||
|
||||
def dates_of_month(self, date = None):
|
||||
"""
|
||||
|
|
|
@ -162,8 +162,8 @@ def diffusion_post_saved(sender, instance, created, *args, **kwargs):
|
|||
instance = page
|
||||
)
|
||||
|
||||
@receiver(pre_delete, sender=aircox.Program)
|
||||
def diffusion_post_deleted(sender, instance, *args, **kwargs):
|
||||
@receiver(pre_delete, sender=aircox.Diffusion)
|
||||
def diffusion_pre_deleted(sender, instance, *args, **kwargs):
|
||||
for page in instance.page.all():
|
||||
if page.specific.body or Page.objects.descendant_of(page).count():
|
||||
continue
|
||||
|
|
Loading…
Reference in New Issue
Block a user