Postgresql has a nice syntax for conditionally inserting:
INSERT INTO child (name, parent_id)
SELECT :name, :parent_id
WHERE EXISTS (
SELECT 1
FROM parent
WHERE id = :parent_id
AND parent.user_id = :user_id
)
In the above example, nothing would be inserted into the child unless the given :user_id was the owner of the parent row.
Is it possible to simulate this kind of insert in Django?