I want to change where a user redirects after an add. For instance,
here I want to add a tag to a course and return to that course
record. The URL in this example is horrendous but the code works. Is
there a better way?
#from url.py:
urlpatterns = patterns('',
(r'^admin/(?P<app_label>course)/(?
P<model_name>coursetagassignment)/add/(?P<post_url>.*)$' ,
'myadmin.views.add_stage_with_post_url'),
)
#from myview.py:
import django.contrib.admin.views.main
def add_stage_with_post_url(request, app_label, model_name,
post_url=None):
return django.contrib.admin.views.main.add_stage(request,
app_label, model_name, post_url='/%s' % (post_url,))
#from the template:
<a href="/admin/course/coursetagassignment/add/admin/course/course/
{{ object_id }}/?course_id={{ object_id }}" class="add-another"
id="add_id_coursetagassignment">
Peace,
David S.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---