Skip to content
This repository has been archived by the owner on Jan 15, 2022. It is now read-only.

Make TEMPLATE_CONTEXT_PROCESSORS checks smarter or more lenient #20

Closed
stevelacey opened this issue May 13, 2015 · 3 comments
Closed

Make TEMPLATE_CONTEXT_PROCESSORS checks smarter or more lenient #20

stevelacey opened this issue May 13, 2015 · 3 comments

Comments

@stevelacey
Copy link

I see django_bootstrap_breadcrumbs.templatetags.django_bootstrap_breadcrumbs: ERROR: request object not found in context! Check if 'django.core.context_processors.request' is in TEMPLATE_CONTEXT_PROCESSORS in my test run all of the time – could this check be made smarter – could just check the setting itself?

django.core.context_processors.request is in my TEMPLATE_CONTEXT_PROCESSORS, the request isn't available because the template is manually rendered.

I add_to_builtins('django_bootstrap_breadcrumbs.templatetags.django_bootstrap_breadcrumbs') in urls.py, so I don't have to write {% load django_bootstrap_breadcrumbs %} everywhere. Is this a bad idea, should I stop? Or should this just not error like this?

https://github.com/prymitive/bootstrap-breadcrumbs/blob/master/django_bootstrap_breadcrumbs/templatetags/django_bootstrap_breadcrumbs.py#L95-L97

@stevelacey stevelacey changed the title request object not found in context! Check if 'django.core.context_processors.request' is in TEMPLATE_CONTEXT_PROCESSORS Make TEMPLATE_CONTEXT_PROCESSORS check smarter or more lenient May 13, 2015
@stevelacey stevelacey changed the title Make TEMPLATE_CONTEXT_PROCESSORS check smarter or more lenient Make TEMPLATE_CONTEXT_PROCESSORS checks smarter or more lenient May 13, 2015
@prymitive
Copy link
Owner

Well, django_bootstrap_breadcrumbs needs to access request object in the context, if it's not there it won't work, so it's checking the right thing. Just having django.core.context_processors.request in settings won't help if request object is not there.

@stevelacey
Copy link
Author

So what do you suggest, stop using this as a builtin?

@dvf
Copy link

dvf commented May 19, 2016

Want to point out that in Django 1.9 the request is now found in django.template.context_processors.request.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants