Beispiel #1
0
 def relation_remove(self, item, attribute, target_resource, target_item):
     before_remove_from_relation.send(self.resource, item=item, attribute=attribute, child=target_item)
     try:
         getattr(item, attribute).remove(target_item)
         after_remove_from_relation.send(self.resource, item=item, attribute=attribute, child=target_item)
     except ValueError:
         pass  # if the relation does not exist, do nothing
 def relation_remove(self, item, attribute, target_resource, target_item):
     before_remove_from_relation.send(self.resource, item=item, attribute=attribute, child=target_item)
     try:
         getattr(item, attribute).remove(target_item)
         after_remove_from_relation.send(self.resource, item=item, attribute=attribute, child=target_item)
     except ValueError:
         pass  # if the relation does not exist, do nothing
Beispiel #3
0
    def relation_remove(self, item, attribute, target_resource, target_item):
        before_remove_from_relation.send(self.resource, item=item, attribute=attribute, child=target_item)

        try:
            getattr(item, attribute).remove(target_item)
        except ValueError:
            pass
        else:
            item.save()
            after_remove_from_relation.send(self.resource, item=item, attribute=attribute, child=target_item)
Beispiel #4
0
 def relation_remove(self, item, attribute, target_resource, target_item):
     before_remove_from_relation.send(self.resource,
                                      item=item,
                                      attribute=attribute,
                                      child=target_item)
     getattr(item, attribute).remove(target_item)
     after_remove_from_relation.send(self.resource,
                                     item=item,
                                     attribute=attribute,
                                     child=target_item)
Beispiel #5
0
 def relation_remove(self, item, attribute, target_resource, target_item):
     before_remove_from_relation.send(self.resource,
                                      item=item,
                                      attribute=attribute,
                                      child=target_item)
     item[attribute] = collection = item.get(attribute, set())
     item_id = target_item[target_resource.manager.id_attribute]
     collection.remove(item_id)
     after_remove_from_relation.send(self.resource,
                                     item=item,
                                     attribute=attribute,
                                     child=target_item)
Beispiel #6
0
    def relation_remove(self, item, attribute, target_resource, target_item):
        before_remove_from_relation.send(self.resource,
                                         item=item,
                                         attribute=attribute,
                                         child=target_item)

        try:
            getattr(item, attribute).remove(target_item)
        except ValueError:
            pass
        else:
            item.save()
            after_remove_from_relation.send(self.resource,
                                            item=item,
                                            attribute=attribute,
                                            child=target_item)
Beispiel #7
0
 def relation_remove(self, item, attribute, target_resource, target_item):
     before_remove_from_relation.send(self.resource, item=item, attribute=attribute, child=target_item)
     item[attribute] = collection = item.get(attribute, set())
     item_id = target_item[target_resource.manager.id_attribute]
     collection.remove(item_id)
     after_remove_from_relation.send(self.resource, item=item, attribute=attribute, child=target_item)
Beispiel #8
0
 def relation_remove(self, item, attribute, target_resource, target_item):
     before_remove_from_relation.send(self.resource, item=item, attribute=attribute, child=target_item)
     getattr(item, attribute).remove(target_item)
     item.save()
     after_remove_from_relation.send(self.resource, item=item, attribute=attribute, child=target_item)