update primary key (and cascade to child tables)
Management command to update a primary key and update all child-tables with a foreign key to this table.
- primary-key
- cascade
Management command to update a primary key and update all child-tables with a foreign key to this table.
Django 1.0 is apparently hard-coded for cascading deletes. I find that I often have nullable foreign keys on models whose records must not be deleted along with those they refer to. I override Model.delete() in an intermediate base class and execute this method to clear out all nullable foreign keys before allowing a delete to proceed.
2 snippets posted so far.