Changes between Initial Version and Version 1 of Ticket #31874
- Timestamp:
- Aug 10, 2020, 4:41:19 AM (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #31874
- Property Resolution → worksforme
- Property Status new → closed
-
Ticket #31874 – Description
initial v1 1 1 Let's say you have a table 2 {{{ 2 3 class Foo(models.Model): 3 4 obj = models.ForeignKey('Bar', on_delete=models.CASCADE) … … 6 7 class Meta: 7 8 unique_together = ('obj', 'x') 8 9 When you use Foo.objects.update_or_create(obj=instance, x=1, defaults={'y': 'test'}), the SQL generated will omit the obj_id from WHERE clause. On the other hand, when obj_id=10 is used, it is used in WHERE clause.9 }}} 10 When you use `Foo.objects.update_or_create(obj=instance, x=1, defaults={'y': 'test'})`, the SQL generated will omit the obj_id from WHERE clause. On the other hand, when obj_id=10 is used, it is used in WHERE clause.