Opened 15 years ago

Closed 15 years ago

#13338 closed (invalid)

adding custom template context processor(s) to settings.py screws up admin

Reported by: marshall.ent@… Owned by: nobody
Component: Template system Version: 1.1
Severity: Keywords: template context processor
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I added my own template context processor:

TEMPLATE_CONTEXT_PROCESSORS = (
    'www.context_processor.static_url',
)

and the admin system stopped receiving its context and I got TemplateSyntaxErrors. It worked again when I added:

TEMPLATE_CONTEXT_PROCESSORS = (
    'www.context_processor.static_url',
    'django.core.context_processors.auth',
)

is there a reason I have to manually add the context processor for auth after creating a custom processor? A user in #django told me to add the following:

from django.conf.global_settings import TEMPLATE_CONTEXT_PROCESSORS

to the top of my settings.py, I did that and added my template context processor using:

TEMPLATE_CONTEXT_PROCESSORS += (
    'www.context_processor.static_url',
)

which seems to have worked. What's going on? Is this the way it's supposed to be or have I done something I'm not supposed to?

Change History (1)

comment:1 by Alex Gaynor, 15 years ago

Resolution: invalid
Status: newclosed

Trac is not for asking support questions, please use #django or the django-users mailing list. For the record this isn't a bug, when you set TEMPLATE_CONTEXT_PROCESSORS you aren't adding to the defaults, you're overiding them, so you need to add the defaults in.

Note: See TracTickets for help on using tickets.
Back to Top