I have a django app which works with a subset of tables within a database. What I want is to create a foreign key to a table which is not managed by the django app, reason is that I want to cascade on delete.
Is it possible to declare a foreign key in my django model to a table which is not controled by my django app?
Something like:
user = models.ForeignKey(table='external_table_name',field='user_id',
on_delete=models.SET_NULL)
You need to set meta options for your model to:
managed=False
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments