Django 1.6 Admin Page Overriding Not Working -
we're trying override admin page django 1.6, continues django/contrib/templates/...:
settings.py:
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) templates = [ { 'backend': 'django.template.backends.django.djangotemplates', 'dirs': [ [os.path.join(base_dir, 'templates')], ], 'options': { 'context_processors': [ # insert template_context_processors here or use # list if haven't customized them: 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.debug', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.contrib.messages.context_processors.messages', ], 'loaders': [ # insert template_loaders here 'django.template.loaders.filesystem.loader', 'django.template.loaders.app_directories.loader', ] }, }, ] ]
and files structure:
project project templates app_name admin file_to_override <--it varies here being inside app_name or inside template
i'm not sure why directories arent working
i don't know why you're using django 1.6, templates dict syntax quote django 1.8+. in previous versions, need specify options individually.
also note have wrongly surrounded dirs value two list brackets.
template_dirs = [ os.path.join(base_dir, 'templates'), ] template_context_processors = [ 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.debug', 'django.template.context_processors.i18n', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.template.context_processors.tz', 'django.contrib.messages.context_processors.messages', ] template_loaders = [ # insert template_loaders here 'django.template.loaders.filesystem.loader', 'django.template.loaders.app_directories.loader', ]
Comments
Post a Comment