No luck.

url.py
url(r'^member/score/compare/$', direct_to_template,
            {'template': 'member_score_compare.html'},
name='member_score_compare'),


view.py
def prev_score(request):
    template_name = 'member_score_compare.html'
    graph = graphs.BarGraph('vBar')
    graph.values = [380, 150, 260, 310, 430]
    myGraph =  graph.create()
    return render_to_response(template_name,
                   { 'graph': myGraph },
                    context_instance=RequestContext(request))

thank you
Bhaskar

On Jan 27, 3:40 am, Daniel Hilton <daniel.hil...@gmail.com> wrote:
> 2010/1/27 Bhaskar Gara <bacch...@gmail.com>:
>
>
>
>
>
> > Hi,
>
> >    I am very new to django.  I am trying to use this library for my
> > graphs
> >http://www.gerd-tentler.de/tools/pygraphs/?page=introduction
>
> > In my Views.py
>
> > prev_score(request):
> >        graph = graphs.BarGraph('vBar')
> >        graph.values = [380, 150, 260, 310, 430]
> >        print graph.create()
>
> > In my Template  "score_compare.html"  in between the screen  I kept
> > below code where it need to display the graph.
>
> >                {{ prev_score }}
>
> > It not erroring out,  but the graph is not displaying.  Please help.
>
> > Thank you
> > Bhaskar
>
> Within a view function you can't print html out, you need to return
> the output of the function.
>
> So, using your example, this should give you your graph:
>
> from django.template import loader, Context
>
> def prev_score(request):
>     graph = graphs.BarGraph('vBar')
>     graph.values = [380, 150, 260, 310, 430]
>     myGraph =  graph.create()
>     t = loader.get_template('my_template.html')
>     c = Context({ 'graph': myGraph })
>     return HttpResponse(t.render(c))
>
> Have a read through this part of the 
> documentation:http://docs.djangoproject.com/en/1.1/topics/http/views/#topics-http-v...
>
> HTH
> Dan
>
>
>
> > --
> > You received this message because you are subscribed to the Google Groups 
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to 
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group 
> > athttp://groups.google.com/group/django-users?hl=en.
>
> --
> Dan Hilton
> ============================www.twitter.com/danhiltonwww.DanHilton.co.uk
> ============================- Hide quoted text -
>
> - Show quoted text -

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to