(self, cls, data, pending_relations=None)
Gets called by this object's create and sync methods just after save.
        Use this to populate fields after the model is saved.

        :param cls: The target class for the instantiated object.
        :param data: The data dictionary received from the Stripe API.
        :type data: dict
Gets called by this object's create and sync methods just after save.
        Use this to populate fields after the model is saved.
Gets called by this object s create and sync methods just after save . Use this to populate fields after the model is saved .
def _attach_objects_post_save_hook(self, cls, data, pending_relations=None):
        """
        Gets called by this object's create and sync methods just after save.
        Use this to populate fields after the model is saved.

        :param cls: The target class for the instantiated object.
        :param data: The data dictionary received from the Stripe API.
        :type data: dict
        """

        unprocessed_pending_relations = []
        if pending_relations is not None:
            for post_save_relation in pending_relations:
                object_id, field, id_ = post_save_relation

                if self.id == id_:
                    # the target instance now exists
                    target = field.model.objects.get(id=object_id)
                    setattr(target, field.name, self)
                    target.save()

                    # reload so that indirect relations back to this object
                    # eg self.charge.invoice = self are set
                    # TODO - reverse the field reference here to avoid hitting the DB?
                    self.refresh_from_db()
                else:
                    unprocessed_pending_relations.append(post_save_relation)

            if len(pending_relations) != len(unprocessed_pending_relations):
                # replace in place so passed in list is updated in calling method
                pending_relations[:] = unprocessed_pending_relations
def _attach_objects_post_save_hook ( self , cls , data , pending_relations = None ) : unprocessed_pending_relations = [ ] if pending_relations is not None : for post_save_relation in pending_relations : object_id , field , id_ = post_save_relation if self . id == id_ : # the target instance now exists target = field . model . objects . get ( id = object_id ) setattr ( target , field . name , self ) target . save ( ) # reload so that indirect relations back to this object # eg self.charge.invoice = self are set # TODO - reverse the field reference here to avoid hitting the DB? self . refresh_from_db ( ) else : unprocessed_pending_relations . append ( post_save_relation ) if len ( pending_relations ) != len ( unprocessed_pending_relations ) : # replace in place so passed in list is updated in calling method pending_relations [ : ] = unprocessed_pending_relations