Closed GoogleCodeExporter closed 8 years ago
Have you set "django.core.context_processors.request" to your
TEMPLATE_CONTEXT_PROCESSORS in your settings.py?
Yes, this issue is missing in the docs.
Original comment by mar...@mahner.org
on 7 Oct 2008 at 9:59
Ah, sorry for my cheeky mouth. It is in the docs, Step #3.
Original comment by mar...@mahner.org
on 7 Oct 2008 at 10:01
yes, I set the request processor, but I guess pagination has conflicton
django-registration or django tags, maybe ??
Original comment by neopro...@gmail.com
on 7 Oct 2008 at 9:14
It should be compatible with both of those projects, as I am using them in
conjunction. I'm marking this as
wontfix until we get more information about the problem.
Original comment by flo...@gmail.com
on 20 Oct 2008 at 12:52
This is the error,
-------------------------------------------------
TemplateSyntaxError at /
Caught an exception while rendering: 'request'
Original Traceback (most recent call last):
File "/Users/xx/django-trunk/django/template/debug.py", line 71, in render_node
File
"/Users/xx/django/django-pagination-svn-trunk/pagination/templatetags/pagination
_tags.py",
line 87, in render
page_obj = paginator.page(context['request'].page)
File "/Users/xx/django-trunk/django/template/context.py", line 43, in __getitem__
KeyError: 'request'
Request Method: GET
Request URL: http://localhost:8000/
Exception Type: TemplateSyntaxError
Exception Value:
Caught an exception while rendering: 'request'
Original Traceback (most recent call last):
File "/Users/xx/django-trunk/django/template/debug.py", line 71, in render_node
File
"/Users/xx/django/django-pagination-svn-trunk/pagination/templatetags/pagination
_tags.py",
line 87, in render
page_obj = paginator.page(context['request'].page)
File "/Users/xx/django-trunk/django/template/context.py", line 43, in __getitem__
KeyError: 'request'
Exception Location: ......views.py in index, line 28
Python Executable:
/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Co
ntents/MacOS/Python
Python Version: 2.5.1
Original comment by neopro...@gmail.com
on 25 Oct 2008 at 1:55
Please add notes about RequestContext module as requirements
-- First way (doesnt work)
def blogs(request):
blogs = blog.objects.order_by('-created_date')
return render_to_response("blog.html", {'blogs': blogs})
-- Second Way (Works)
from models import blog
from django.shortcuts import render_to_response
from django.template import RequestContext
def blogs(request):
blogs = blog.objects.order_by('-created_date')
return render_to_response("blog.html", {'blogs': blogs},
context_instance=RequestContext(request))
thanks,
Original comment by neopro...@gmail.com
on 26 Oct 2008 at 12:57
I had the same error. neoprolog fix works alright. thanks man
Original comment by bernard....@gmail.com
on 18 Nov 2008 at 3:22
Same here. Would help to specify that in the doc install. Otherwise, great app.
Thanks
Original comment by Gaarv1...@gmail.com
on 18 Dec 2008 at 12:53
Hello,
If you don't want to use the render_to_response-method, but loader-method, it
goes
like this:
from django.template import loader, RequestContext
def blogs(request):
blog = blog.objects.all()
t = loader.get_template("blog.html")
c = RequestContext(request, {"blogs": blogs})
return HttpResponse(t.render(c))
Original comment by tatu.kairi@gmail.com
on 20 Feb 2009 at 7:13
[deleted comment]
i used this to paginate comments, the comments tree was passed from a
templatetag
like this:
def comment_app(context):
comments_tree = Comments.objects.get_tree_for_object(context['content_object'])
return {
'comments_tree': comments_tree,
'request': context['request']
}
register.inclusion_tag('comments/comment_app.html',
takes_context=True)(comment_app)
note the: 'request': context['request']
Original comment by chli...@gmail.com
on 30 Apr 2009 at 7:54
Thanks so much for the solution here. Worked well.
Original comment by chokos...@gmail.com
on 8 Oct 2009 at 12:18
nothing worked for me
view:
from demot.demoty.models import Demotivator
from django.shortcuts import render_to_response
from django.template import loader, RequestContext
def all(request):
demotywatory = Demotivator.objects.order_by('-create_time')
return render_to_response('demoty/all.html',
{'demotywatory': demotywatory},
context_instance=RequestContext(request))
Error:
TemplateSyntaxError at /demotywatory/
Caught an exception while rendering: 'request'
Original Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\django\template\debug.py", line 72, in render_node
result = node.render(context)
File "C:\Documents and
Settings\Admin\Pulpit\Wszystko\django\demot\pagination\templatetags\pagination_t
ags.py",
line 90, in render
page_obj = paginator.page(context['request'].page)
File "C:\Python25\Lib\site-packages\django\template\context.py", line 46, in
__getitem__
raise KeyError(key)
KeyError: 'request'
Request Method: GET
Request URL: http://localhost:8000/demotywatory/
Exception Type: TemplateSyntaxError
Exception Value:
Caught an exception while rendering: 'request'
Original Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\django\template\debug.py", line 72, in render_node
result = node.render(context)
File "C:\Documents and
Settings\Admin\Pulpit\Wszystko\django\demot\pagination\templatetags\pagination_t
ags.py",
line 90, in render
page_obj = paginator.page(context['request'].page)
File "C:\Python25\Lib\site-packages\django\template\context.py", line 46, in
__getitem__
raise KeyError(key)
KeyError: 'request'
Exception Location: C:\Python25\Lib\site-packages\django\template\debug.py in
render_node, line 82
Python Executable: C:\Python25\python.exe
Python Version: 2.5.0
Python Path: ['C:\\Documents and
Settings\\Admin\\Pulpit\\Wszystko\\django\\demot',
'C:\\WINDOWS\\system32\\python25.zip', 'C:\\Python25\\DLLs',
'C:\\Python25\\lib',
'C:\\Python25\\lib\\plat-win', 'C:\\Python25\\lib\\lib-tk', 'C:\\Python25',
'C:\\Python25\\lib\\site-packages']
Server time: So, 16 Sty 2010 22:54:49 +0100
Original comment by crackc...@gmail.com
on 16 Jan 2010 at 9:55
ah, thanks, neopro's solution (Comment 6) worked well
Original comment by machines...@gmail.com
on 14 Sep 2011 at 8:36
@neoprolog Thanx man. I also had the same problem. +1
Original comment by sawan.gu...@gmail.com
on 25 Jul 2013 at 9:58
Original issue reported on code.google.com by
neopro...@gmail.com
on 4 Oct 2008 at 9:35