I have 2 tables products and catagories connected by foreign key. I need to update field products.new_cost using field catagorie
products
catagories
products.new_cost
catagorie
You cannot use F, but you can use Subquery and OuterRef:
from django.db.models import Subquery, OuterRef cost = Category.objects.filter( id=OuterRef('category_id') ).values_list( 'price_markup' )[:1] Product.objects.update( new_cost=Subquery(cost) )