It's generally very messy for one "view" function to call another.
Better solution is to factorise out the common parts into a third function,
then make sure each of your two "view" functions have the required
render_to_response.
Also, I highly recommend using the "render" shortcut, which would turn your
more complex calls into this:
return render ( request, 'report/report_base.html', {'Head':Head,} )
On Thursday, November 29, 2012 10:31:03 PM UTC-8, Satinderpal Singh wrote:
>
> I have to call a function into another function which displays the
> values from the database to the browser, like this:
>
> def result(request):
> zee = head.objects.aggregate(Max('id'))
> mee = zee['id__max']
> Head = head.objects.filter(id = mee)
> return render_to_response('report/report_base.html',
> {'Head':Head,},context_instance=RequestContext(request))
>
> def result_cube(request):
> Head = result(mee)
> organisation = Organisation.objects.all().filter(id = 1)
> return render_to_response('report/cube.html', { 'Head':Head,
> 'organisation':organisation},context_instance=RequestContext(request))
>
> I want to call "result" view in the "result_cube", as it displays the
> html data but not showing the data from the database.
>
> --
> Satinderpal Singh
> http://satindergoraya.blogspot.in/
> http://satindergoraya91.blogspot.in/
>
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/sv67A78gud4J.
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.