Django {{site}} template context not working? -
this should super simple one. i'm pretty sure i've used context in past in templates linking purposes. belief built requestcontext instance somehow or other.
the site_id record in settings file correct. i've included requestcontext instance views , have included contrib.auth app, may relevant in case.
is {{site}} context somehow built in or should query sites object instance?
thanks all, brendan
django strives explicit, unlikely set context self. there has context processor sets {{site}}
in settings.context_processors
. i've checked django.core.context_processors
, django.contrib.sites
, there no such processor sets site
. had third-party context processor that.
it easy write context processor:
myproject/context_processors.py: django.contrib.sites.models import site def site(request): return { 'site': site.objects.get_current() } myproject/settings.py: context_processors += ['myproject.context_processors.site']
Comments
Post a Comment