Code

Opened 6 months ago

Closed 6 months 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

Description

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.

Attachments (0)

Change History (3)

comment:1 Changed 6 months 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 6 months 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 6 months 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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.