I have a Django project with a model, something like this:
title = models.CharField(max_length=255)
name = models.CharField(max_lenght=255)
a_side_disc = models.ForeignKey(Track, null=True,
b_side_disc = models.ForeignKey(Track, null=True,
in_jukebox = models.BooleanField()
This model is totally made up, and don't make sense, but it shows my current setup in this case.
Now with Django 1.11 and Django Restframework, I have a route with a delete for a Track. When I call the Route, I check if the Track is on a Disc with in_jukebox set to False. If that is the case I simply go on with the delete.
I expect that both ForeignKeys in Disc are set to Null, but instead Disc is deleted as well like I would expect from CASCADE.
I use Postgres as database, and inspected the generated Schema. I understand that SET_NULL is done by django and not the database. But it is not done.
Am I understanding somthing wrong? Which direction is on_delete working, and if it's only one, how do I make the same on the other side?