Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#7982 closed (fixed)

ModelAdmin primarykeys

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

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 16 years ago.
Patch, not yet finished
7982_against_trunk.diff (2.8 KB ) - added by sebastian.hillig 16 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 by sorl, 16 years ago

Component: UncategorizedAdmin interface

comment:2 by sebastian.hillig, 16 years ago

Has patch: set

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

comment:3 by sebastian.hillig, 16 years ago

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 by Jacob, 16 years ago

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

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

by sebastian.hillig, 16 years ago

Attachment: ticket7982against8487.diff added

Patch, not yet finished

comment:5 by sebastian.hillig, 16 years ago

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 by Brian Rosner, 16 years ago

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.

by sebastian.hillig, 16 years ago

Attachment: 7982_against_trunk.diff added

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

in reply to:  6 comment:7 by sebastian.hillig, 16 years ago

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

comment:8 by Brian Rosner, 16 years ago

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 by Jacob, 13 years ago

milestone: 1.0

Milestone 1.0 deleted

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