Skip to content

Commit 1330c2c

Browse files
committed
Remove __set__ from FKAsOneToOne as it seemed to not work at all and gets in the way when creating new objects
- Legacy-Id: 2288
1 parent 700db39 commit 1330c2c

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

branch/iesg-tracker/ietf/utils/cache_foreign_key.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,7 @@ def __get__(self, instance, Model):
3636

3737
return instance._field_values[self.field]
3838

39-
def __set__(self, instance, value):
40-
if self.reverse:
41-
# this is dangerous
42-
#other_instance = self.__get_attr(instance).all()[0]
43-
#setattr(other_instance, self.field, value)
44-
#other_instance.save()
45-
raise NotImplemented
46-
else:
47-
setattr(instance, self.field, value)
39+
# We don't try to be smart and define __set__ to adjust the other
40+
# end of the relation since that could require setting several
41+
# fields, failing silently with a naive implementation. Updating
42+
# the other end is the responsibility of the caller.

0 commit comments

Comments
 (0)