Opened 8 years ago

Closed 8 years ago

Last modified 5 years ago

#7982 closed (fixed)

ModelAdmin primarykeys

Reported by: sorl Owned by: sebastian.hillig
Component: contrib.admin Version: master
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

A models primary keys used with ModelAdmin cannot end with: add, history nor delete. See call method of ModelAdmin in options.py, url scheme probably needs to be changed to fix this.

Attachments (2)

ticket7982against8487.diff (4.6 KB) - added by sebastian.hillig 8 years ago.
Patch, not yet finished
7982_against_trunk.diff (2.8 KB) - added by sebastian.hillig 8 years ago.
Patch, doesn't fix /add/ but the other two cases, adds test for all three

Download all attachments as: .zip

Change History (11)

comment:1 Changed 8 years ago by sorl

Component: UncategorizedAdmin interface
Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

comment:2 Changed 8 years ago by sebastian.hillig

Has patch: set

Woops, kinda didn't fix it ... looking through it again :P

comment:3 Changed 8 years ago by sebastian.hillig

Has patch: unset
milestone: 1.0 maybe
Owner: changed from nobody to sebastian.hillig
Status: newassigned
Triage Stage: UnreviewedDesign decision needed

Having looked into this again, i guess one would either have to decouple the actions from the model url or run into those problems over and over again using a char primary key because of those reserved words, or prefix all specific object requests with something like model/objects/pk.

(ignore the patch, wasn't recognizing the real problem)

comment:4 Changed 8 years ago by Jacob

milestone: 1.0 maybe1.0
Triage Stage: Design decision neededAccepted

(deleted patch just so that I don't get confused.)

Changed 8 years ago by sebastian.hillig

Attachment: ticket7982against8487.diff added

Patch, not yet finished

comment:5 Changed 8 years ago by sebastian.hillig

Has patch: set

The patch changes the url-schema of the admin as following:

app/model/ # No view -> redirects to objects/ (maybe a future "choose your view/manager?")

app/model/objects/ # List view

app/model/objects/pk # Particular object

app/model/objects/pk/action # Action on particular object, history/delete

app/model/add/ # Create a new object

Currently has one left issue, which is marked as a TODO in the ticket, saving an already existing model with saveandnew currently doesn't get the right url (wish i had an admin urlconf to make this patch somewhat nicer).

comment:6 Changed 8 years ago by Brian Rosner

I don't like this patch right now. It introduces a backward incompatibility in the admin URL schema. This ticket is really a duplicate of #6470, but it was renamed to be the correct fix. The delete and history case and be easily fixed, but the add case is going to be nearly impossible in any case.

Changed 8 years ago by sebastian.hillig

Attachment: 7982_against_trunk.diff added

Patch, doesn't fix /add/ but the other two cases, adds test for all three

comment:7 in reply to:  6 Changed 8 years ago by sebastian.hillig

Correction: It fixes all cases but the pk "add".

comment:8 Changed 8 years ago by Brian Rosner

Resolution: fixed
Status: assignedclosed

(In [8704]) Fixed #7982 -- Corrected ModelAdmin url dispatching to ensure it matching exactly what it needs and doesn't stomp on primary key space. 'add' is a lost cause for now. This originated from #6470. Thanks jdetaeye for the original patch and basith for providing test cases.

comment:9 Changed 5 years ago by Jacob

milestone: 1.0

Milestone 1.0 deleted

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