How to use the djangochannelsrestframework.observer.model_observer.Action.CREATE function in djangochannelsrestframework

To help you get started, we’ve selected a few djangochannelsrestframework examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hishnash / djangochannelsrestframework / djangochannelsrestframework / observer / model_observer.py View on Github external
self.get_observer_state(instance).current_groups = new_group_names

        # if post delete, new_group_names should be []

        # Django DDP had used the ordering of DELETE, UPDATE then CREATE for good reasons.
        self.send_messages(
            instance, old_group_names - new_group_names, Action.DELETE, **kwargs
        )
        # the object has been updated so that its groups are not the same.
        self.send_messages(
            instance, old_group_names & new_group_names, Action.UPDATE, **kwargs
        )

        #
        self.send_messages(
            instance, new_group_names - old_group_names, Action.CREATE, **kwargs
        )
github hishnash / djangochannelsrestframework / djangochannelsrestframework / observer / model_observer.py View on Github external
def post_save_receiver(self, instance: Model, created: bool, **kwargs):
        """
        Handle the post save.
        """
        if created:
            self.database_event(instance, Action.CREATE)
        else:
            self.database_event(instance, Action.UPDATE)