Opened 11 years ago

Closed 10 years ago

#4516 closed (duplicate)

newforms-admin: Move AdminModel's URL handling into a method

Reported by: Marty Alchin <gulopine@…> Owned by: nobody
Component: contrib.admin Version: newforms-admin
Severity: Keywords: nfa-someday handle_url
Cc: schlaber@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


After some discussions on django-developers, this patch moves ModelAdmin's URL handling into a separate method that can then be overridden by subclasses to provide extra hooks into the model's URL scheme.

Attachments (1)

handle_url.diff (682 bytes) - added by Marty Alchin <gulopine@…> 11 years ago.
Simple patch to make ModelAdmin URL handling more flexible for subclasses

Download all attachments as: .zip

Change History (8)

Changed 11 years ago by Marty Alchin <gulopine@…>

Attachment: handle_url.diff added

Simple patch to make ModelAdmin URL handling more flexible for subclasses

comment:1 Changed 11 years ago by Brian Rosner

Version: SVNnewforms-admin

+1. I have already overridden __call__ and it is pretty nasty and I end up losing the dependancy checks. However, I think the new method needs to be improved slightly. Based on the patch given here if I override handle_url I will still need to check for None and display the changelist page then call the parent. If I call the parent first then change_view will always have to run before I can check for my own URL. It seems to me that the URL mapping in AdminSite and ModelAdmin need to be refactored a little bit for better customization.

comment:2 Changed 11 years ago by Brian Rosner

Oh yeah, almost forgot. I am writing an app called djog that allows for some URL mapping through a class similar to how AdminSite and ModelAdmin work. I have hooked the views (aka methods in the class) to the app's Take a look here: This might prove to be a better way. Not sure, since my implementation with djog has been real world tested yet.

comment:3 Changed 11 years ago by Marty Alchin

It's been a while since I had thought about this. Malcolm and I had some discussion a while back about expanding how URL resolution happens, and if anything comes of that, this problem would be a bit easier to solve. If it works the way I think it will, it would even make the override problem easier to deal with. I figure this ticket can just be put on hold for now, while we see if anything comes of the RULResolver stuff. And no, I'm not just hoping someone else will do it, I'm actively looking into it.

comment:4 Changed 11 years ago by Brian Rosner

Keywords: nfa-someday added; newforms-admin removed

This ticket isn't critical to the merge of newforms-admin. Tagging with nfa-someday.

comment:5 Changed 11 years ago by Jacob

Triage Stage: UnreviewedAccepted

comment:6 Changed 10 years ago by anonymous

Cc: schlaber@… added

comment:7 Changed 10 years ago by Brian Rosner

Resolution: duplicate
Status: newclosed

Ultimately #6470 will address this issue, but recently the dependancy check has been moved leaving __call__ only routing. Closing in favor of #6470.

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