python - django view not passing a value to the temple using render_to_response -



python - django view not passing a value to the temple using render_to_response -

i followed this link , tried similar in django app. in views.py defined this:

def acadprogram(request): name = program_requirement_category.objects.get(name='as.science') student_id = 2773951 values = {'student_id':student_id} descendants = name.get_descendants(include_self=true) homecoming render_to_response("courses.html", {'nodes':descendants.all()}, values, context_instance = requestcontext(request))

and tried accessing student_id this:

<h3><font color=#428bca>caleb streeter {{student_id}}</font></h3>

but django threw me error follows:

render_to_string() got multiple values keyword argument 'context_instance'

so how seek passing value through render_to_response?

two options:

edit values be

values = {'student_id':student_id, 'nodes':descendants.all() }

and return

render_to_response("courses.html", values, context_instance = requestcontext(request))

or simply

return render_to_response("courses.html", {'nodes':descendants.all(), 'student_id':student_id}, context_instance = requestcontext(request))

python django

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -