I have an object of type Foo with a ForeignKey to a Bar. Bar has a property called slug.
I can do
myfoo.bar = Bar.objects.get(slug='123')
But this would add an extra query. Is it possible to have Django generate the assignment as a sub-query within the update?
i.e. generate SQL similar to:
UPDATE myfoo SET bar_id = (select id from bar where slug = '123')