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