Opened 18 years ago

Closed 16 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

Description

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@…> 18 years ago.
Simple patch to make ModelAdmin URL handling more flexible for subclasses

Download all attachments as: .zip

Change History (8)

by Marty Alchin <gulopine@…>, 18 years ago

Attachment: handle_url.diff added

Simple patch to make ModelAdmin URL handling more flexible for subclasses

comment:1 by Brian Rosner, 17 years ago

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

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 url.py. Take a look here: http://dev.oebfare.com/projects/djog/browser/trunk/djog/urls.py. This might prove to be a better way. Not sure, since my implementation with djog has been real world tested yet.

comment:3 by Marty Alchin, 17 years ago

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

Keywords: nfa-someday added; newforms-admin removed

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

comment:5 by Jacob, 17 years ago

Triage Stage: UnreviewedAccepted

comment:6 by anonymous, 17 years ago

Cc: schlaber@… added

comment:7 by Brian Rosner, 16 years ago

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