diff --git a/aircox/management/commands/diffusions.py b/aircox/management/commands/diffusions.py index 6565c1b..db51a76 100755 --- a/aircox/management/commands/diffusions.py +++ b/aircox/management/commands/diffusions.py @@ -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) diff --git a/aircox/models.py b/aircox/models.py index 0b34045..f97836e 100755 --- a/aircox/models.py +++ b/aircox/models.py @@ -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): """ diff --git a/aircox_cms/signals.py b/aircox_cms/signals.py index 711f0de..c4ccf16 100755 --- a/aircox_cms/signals.py +++ b/aircox_cms/signals.py @@ -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