Code

Opened 7 years ago

Closed 4 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@…> 7 years ago.
untested code

Download all attachments as: .zip

Change History (5)

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

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from [enhancement] django.views.generic.simple.redirect_to_absolute_url to django.views.generic.simple should have a method to redirect to the absolute_url() of an object
  • Triage Stage changed from Unreviewed to Design decision needed

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

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

untested code

comment:2 Changed 5 years ago by redbaron

Sounds good, whats problem to include it in mainline?

comment:3 Changed 5 years ago by redbaron

  • Cc ivanov.maxim@… added

comment:4 Changed 4 years ago by mtredinnick

  • Resolution set to wontfix
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.