def update_stock(product_id, quantity_sold): product = Product.objects.get(id=product_id) product.stock -= quantity_sold product.save()
Sprawdź odpowiedź