﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
31874	FK id is not used in update_or_create when id is not used directly	Erki Bender	nobody	"Let's say you have a table
{{{
class Foo(models.Model):
    obj = models.ForeignKey('Bar', on_delete=models.CASCADE)
    x = model.IntegerField()
    y = model.CharField(length=10)
    class Meta:
        unique_together = ('obj', 'x')
}}}
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."	Bug	closed	Database layer (models, ORM)	3.0	Normal	worksforme			Unreviewed	0	0	0	0	0	0
