Take the 2-minute tour ×

I am facing a problem .I want to give a link in my change form that will redirect to a page which may be simple php page also or any page ,in that page i want to perform some db queries and display them.I also wan to pass id on click.Is it posssible.

in my view.py

i wrote:

from django.shortcuts import render_to_response

from django.template import RequestContext

def MyClass(self,id,request):

    return render_to_response('admin/custom_change_form.html')#my template location

my model and admin files are simple

share|improve this question
add comment

3 Answers

Yes .

share|improve this answer
+1 (Humour, accurate response) –  Matthew Schinckel Jul 9 '09 at 7:25
add comment

To send to a file directly, use direct_to_template(). You can pass anything in the url that you like - just give the information to your template, and write it in the url. After all, Django doesn't require url helpers.

I sense that whatever you're trying to do is some god-awful hackish thing that would be much better served by doing it all in Django.

share|improve this answer
add comment

You will need to override your change form for that model and display whatever you would like. But that is making the assumption you are talking about the contrib admin within Django.

Realistically you have not provided sufficient information for anyone to accurately answer your question.

share|improve this answer
yes i am trying to overide my change_form.html.I have wirtten this change_form.html for the model but when i call i the template it is giving me error ''Caught an exception while rendering: opts'' .CAn u givr me any suggestion its is urgent. I m editing my question –  ha22109 Jul 9 '09 at 9:50
Uh. You are doing it incorrectly. If you are using the contrib admin you override the existing form using the same name. The rendering error you have is a different issue. You are still giving way too little information on what you are really actually trying to do. –  wlashell Jul 9 '09 at 16:29
add comment

Your Answer


