prymitive / bootstrap-breadcrumbs

Django template tags for easy breadcrumbs using twitter bootstrap css classes or custom template
django-bootstrap-breadcrumbs.readthedocs.org
MIT License
92 stars 47 forks source link

Make TEMPLATE_CONTEXT_PROCESSORS checks smarter or more lenient #20

Closed stevelacey closed 6 years ago

stevelacey commented 9 years ago

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

prymitive commented 9 years ago

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 commented 9 years ago

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

dvf commented 8 years ago

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