Changes between Initial Version and Version 1 of Ticket #34884, comment 1
- Timestamp:
- Sep 29, 2023, 7:18:48 PM (14 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #34884, comment 1
initial v1 12 12 def patched_get_or_create(self, defaults=None, **kwargs): 13 13 result, created = original_get_or_create(self, defaults=defaults, **kwargs) 14 if defaults is not None :14 if defaults is not None and created: 15 15 for key, value in defaults.items(): 16 16 if isinstance(result._meta.get_field(key), ForeignKey): … … 37 37 In [17]: def patched_get_or_create(self, defaults=None, **kwargs): 38 38 ...: result, created = original_get_or_create(self, defaults=defaults, **kwargs) 39 ...: if defaults is not None :39 ...: if defaults is not None and created: 40 40 ...: for key, value in defaults.items(): 41 41 ...: if isinstance(result._meta.get_field(key), ForeignKey):