Opened 5 years ago

Closed 5 years ago

#21265 closed Uncategorized (wontfix)

on_update foreign key

Reported by: mirzadelic1@… Owned by: nobody
Component: Database layer (models, ORM) Version: 1.5
Severity: Normal Keywords: on_dalete, foreignkey
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


When i use custom primary key and i change value of it, my foreign keys can't be updates, there is no on_update cascade option?
I use postgres db.

Change History (3)

comment:1 Changed 5 years ago by Anssi Kääriäinen

Resolution: wontfix
Status: newclosed

No, there is currently no on_update functionality. In addition, it is unlikely that Django will ever officially support cascades for foreign keys targeting updatable primary keys. It is somewhat likely that updatable primary keys will be documented as unsupported.

I am marking this as wontfix. This resolution is specifically about on_update for foreign keys targeting primary key values. I do support adding on_update support to foreign keys targeting other fields than the model's primary key.

As a workaround you can manually alter the database constraints to be "ON UPDATE CASCADE".

comment:2 Changed 5 years ago by anonymous

Resolution: wontfix
Status: closednew

I did manualy that and its working on db level, but when edit in django i get "list index out of range" ?

comment:3 Changed 5 years ago by Anssi Kääriäinen

Resolution: wontfix
Status: newclosed

Sorry, this isn't a support channel. Try to ask for help at #django IRC channel or django-users mailing list.

Note: See TracTickets for help on using tickets.
Back to Top