Opened 10 years ago

Closed 6 years ago

#4238 closed (wontfix)

django.views.generic.simple should have a method to redirect to the absolute_url() of an object

Reported by: David Cramer <dcramer@…> Owned by: nobody
Component: Generic views Version: master
Severity: Keywords:
Cc: ivanov.maxim@… Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Would be a handy addition to the generic views which would allow you to redirect a URL to the get_absolute_url of an object.

This can be used in many situations, the most common being URL changes.

'/myoldurl/(?P<id>[0-9]+)/', 'django.views.generic.simple.redirect_to_absolute_url', {'pk': '%(id)s'}

Attachments (1)

redirect_to_absolute_url.py (469 bytes) - added by David Cramer <dcramer@…> 10 years ago.
untested code

Download all attachments as: .zip

Change History (5)

comment:1 Changed 10 years ago by Simon G. <dev@…>

Summary: [enhancement] django.views.generic.simple.redirect_to_absolute_urldjango.views.generic.simple should have a method to redirect to the absolute_url() of an object
Triage Stage: UnreviewedDesign decision needed

Sounds like a good idea - want to try and write up an implementation?

Changed 10 years ago by David Cramer <dcramer@…>

Attachment: redirect_to_absolute_url.py added

untested code

comment:2 Changed 8 years ago by Maxim Ivanov

Sounds good, whats problem to include it in mainline?

comment:3 Changed 8 years ago by Maxim Ivanov

Cc: ivanov.maxim@… added

comment:4 Changed 6 years ago by Malcolm Tredinnick

Resolution: wontfix
Status: newclosed

Not clear this is a common enough use-case to require a function in Django, particularly given the function itself is so short to write.

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