Opened 3 years ago

Closed 3 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 3 years ago by akaariai

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to wontfix
  • Status changed from new to closed

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 3 years ago by anonymous

  • Resolution wontfix deleted
  • Status changed from closed to new

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 3 years ago by akaariai

  • Resolution set to wontfix
  • Status changed from new to closed

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