def generic_event_history(sender, instance, created, **kwargs): if created: post_save.disconnect(generic_event_history, sender=GenericEvent) instance.history = prepare_history(None, instance.user.id) instance.save() post_save.connect(generic_event_history, sender=GenericEvent) else: prepare_history(instance.history, instance.user.id)
def common_history(sender, instance, created, **kwargs): if created or not instance.history: post_save.disconnect(common_history, sender=sender) instance.history = prepare_history(None, instance._user_id) instance.save() post_save.connect(common_history, sender=sender) else: prepare_history(instance.history, instance._user_id)
def update_estate(sender, instance, created, **kwargs): if instance.client.history: prepare_history(instance.client.history, instance.user_id) if instance.client.pk: for estate in instance.client.estates.all(): estate.set_contact() estate.save() prepare_history(estate.history, instance.user_id)
def bid_event_history(sender, instance, created, **kwargs): if created: post_save.disconnect(bid_event_history, sender=BidEvent) instance.history = prepare_history(None, instance._user_id) instance.save() post_save.connect(bid_event_history, sender=BidEvent) else: prepare_history(instance.history, instance._user_id) prepare_history(instance.bid.history, instance._user_id)
def bid_event_history(sender, instance, created, **kwargs): if created: post_save.disconnect(bid_event_history, sender=BidEvent) instance.history = prepare_history(None, instance._user_id) instance.save() post_save.connect(bid_event_history, sender=BidEvent) else: prepare_history(instance.history, instance._user_id) instance.bid.update_state() prepare_history(instance.bid.history, instance._user_id)
def post(self, request, *args, **kwargs): self.update_object(self.kwargs['pk'], self.kwargs['partner_pk']) prepare_history(Partner.objects.get(pk=self.kwargs['partner_pk']).history, self.request.user.pk) return HttpResponseRedirect(self.request.REQUEST.get('next', ''))
def update_estate_m2m(sender, instance, created, **kwargs): user = instance.user if hasattr(instance, 'user') else instance.estate.history.updated_by prepare_history(instance.estate.history, user) estate_wp_meta_base(instance.estate)
def update_deleted(sender, instance, created, **kwargs): if instance.deleted: for estate in instance.estates.all(): estate.set_contact() estate.save() prepare_history(estate.history, instance._user_id)
def update_estate_m2m(sender, instance, created, **kwargs): prepare_history(instance.estate.history, instance.estate.history.updated_by) estate_wp_meta_base(instance.estate)