Opened 19 years ago

Closed 19 years ago

#1425 closed defect (fixed)

[patch] Update "View on site" redirect handler to new model API

Reported by: Christopher Lenz <cmlenz@…> Owned by: Adrian Holovaty
Component: contrib.admin Version: magic-removal
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The shortcut view in [source:/django/branches/magic-removal/django/views/defaults.py django.views.defaults] is currently broken on the magic-removal branch do to using the old model API.

Attachments (2)

django_1425.diff (1.4 KB ) - added by Christopher Lenz <cmlenz@…> 19 years ago.
Patch that updates the shortcut view for the new model API
django_1425.2.diff (2.6 KB ) - added by Christopher Lenz <cmlenz@…> 19 years ago.
Updated patch that checks the target model of relations

Download all attachments as: .zip

Change History (7)

by Christopher Lenz <cmlenz@…>, 19 years ago

Attachment: django_1425.diff added

Patch that updates the shortcut view for the new model API

comment:1 by Christopher Lenz <cmlenz@…>, 19 years ago

Actually, I'm not sure about the parts of that patch that alter the support for relations to the Site model. They probably shouldn't rely on the relation having a specific name...

comment:2 by Adrian Holovaty, 19 years ago

Perhaps, instead of looking for an attribute called 'site', it could poke around in obj._meta and look for a relation to the Site model.

by Christopher Lenz <cmlenz@…>, 19 years ago

Attachment: django_1425.2.diff added

Updated patch that checks the target model of relations

comment:3 by Christopher Lenz <cmlenz@…>, 19 years ago

Right, I've updated the patch to check whether the field.rel.to is Site for both many-to-many and other relations. Feels a bit hackish, but hey :-P

comment:4 by Christopher Lenz <cmlenz@…>, 19 years ago

The more “boring” part of this patch was included in [2475] for #1447.

comment:5 by Jacob, 19 years ago

Resolution: fixed
Status: newclosed

(In [2615]) magic-removal: fixed #1425 -- django.views.defaults.shortcut now works correctly (thanks, Christopher Lenz)

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