I have a Django model that refers to itself as below:
parent = models.ForeignKey('self', ...)
I need to act in some situations as on_delete=models.CASCADE and in other situations as on_delete=models.DO_NOTHING. How can I do that?
I have a Django model that refers to itself as below:
parent = models.ForeignKey('self', ...)
I need to act in some situations as on_delete=models.CASCADE and in other situations as on_delete=models.DO_NOTHING. How can I do that?