views:

145

answers:

3

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

+1  A: 

Yes .

a_m0d
+1 (Humour, accurate response)
Matthew Schinckel
+1  A: 

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.

Xiong Chiamiov
+1  A: 

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.

wlashell
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
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