On 27 January 2010 17:56, Bhaskar Gara <bacch...@gmail.com> wrote: > I am really stupid. After cut & Paste I need to double check what i > pasted. > > Thank you very much Dan and sorry for wasting your time. > > Lesson learned.
I usually find all my mistakes are stupid ones. I actually find a little comfort in this! Good luck with Django - it's a great framework. Cheers, Dan > > On Jan 27, 11:16 am, Daniel Hilton <daniel.hil...@gmail.com> wrote: >> 2010/1/27 Bhaskar Gara <bacch...@gmail.com>: >> >> >> >> >> >> > 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 >> >> In your example, the request will never touch your view function as >> you're using the generic view to render straight to template. >> Try placing this at the top of your urls.py: >> >> from YOUR_APP_NAME.views import view >> >> And then in your urls.py: >> >> url(r'^member/score/compare/$', view, >> {'template': 'member_score_compare.html'}, >> name='member_score_compare'), >> >> Although you'll prob get an error on your view name. Have a look >> at:http://docs.djangoproject.com/en/1.1/topics/http/urls/#topics-http-urls >> >> HTH >> >> Dan >> >> >> >> >> >> >> >> > 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 >> > athttp://groups.google.com/group/django-users?hl=en. >> >> -- >> Dan Hilton >> ============================www.twitter.com/danhiltonwww.DanHilton.co.uk >> ============================- Hide quoted text - >> >> - Show quoted text -- 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. > > -- Dan Hilton ============================ www.twitter.com/danhilton www.DanHilton.co.uk ============================ -- 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.