[Answer]-Django OneToOneField deleting child doesn't set parents parameter as None?

1👍

p.discount = None

Changing something in the database will not affect model instances in memory. In 1.8 you can also easily reload the object from the db:

p.refresh_from_db()

Or before 1.8:

p = Product.objects.get(pk=p.pk)
👤knbk

Leave a comment