def _set(self, values): assert len(values) == 1, 'RelationManager %s expected 1 value to be added to instance cache, got %s' %(self, len(values)) inst = values[0] # if inst in self.all(): # return self._type_check(inst) q = ForeignKeyUpdateQuery(self.owner, self.identifier, inst.pk, self.db) q.execute() q.commit()
def _delete(self): q = ForeignKeyUpdateQuery(self.owner, self.identifier, None, self.db) q.execute() q.commit()