Beispiel #1
0
 def relation_add(self, item, attribute, target_resource, target_item):
     before_add_to_relation.send(
         self.resource, item=item, attribute=attribute, child=target_item
     )
     getattr(item, attribute).append(target_item)
     after_add_to_relation.send(
         self.resource, item=item, attribute=attribute, child=target_item
     )
Beispiel #2
0
 def relation_add(self, item, attribute, target_resource, target_item):
     before_add_to_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.add(item_id)
     after_add_to_relation.send(self.resource,
                                item=item,
                                attribute=attribute,
                                child=target_item)
Beispiel #3
0
 def relation_add(self, item, attribute, target_resource, target_item):
     before_add_to_relation.send(self.resource, item=item, attribute=attribute, child=target_item)
     getattr(item, attribute).append(target_item)
     item.save()
     after_add_to_relation.send(self.resource, item=item, attribute=attribute, child=target_item)
Beispiel #4
0
 def relation_add(self, item, attribute, target_resource, target_item):
     before_add_to_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.add(item_id)
     after_add_to_relation.send(self.resource, item=item, attribute=attribute, child=target_item)