Skip to content

Instantly share code, notes, and snippets.

@AndyLPK247
Created April 21, 2018 14:22
Show Gist options
  • Save AndyLPK247/1b5c51447890c11305f930129b1bf5ff to your computer and use it in GitHub Desktop.
Save AndyLPK247/1b5c51447890c11305f930129b1bf5ff to your computer and use it in GitHub Desktop.
Django Admin Translations base_site.html Override
{% extends "admin/base_site.html" %}
{% load static %}
{% load i18n %}
<!-- custom filter module -->
{% load i18n_switcher %}
{% block extrahead %}
<link rel="shortcut icon" href="{% static 'images/favicon.ico' %}" />
<link rel="stylesheet" type="text/css" href="{% static 'css/custom_admin.css' %}"/>
{% endblock %}
{% block userlinks %}
<a href="{{ request|switch_i18n:'en' }}">
<img class="i18n_flag" src="{% static 'images/flag-usa-16.png' %}"/>
</a> /
<a href="{{ request|switch_i18n:'zh-hans' }}">
<img class="i18n_flag" src="{% static 'images/flag-china-16.png' %}"/>
</a> /
{% if user.is_active and user.is_staff %}
{% url 'django-admindocs-docroot' as docsroot %}
{% if docsroot %}
<a href="{{ docsroot }}">{% trans 'Documentation' %}</a> /
{% endif %}
{% endif %}
{% if user.has_usable_password %}
<a href="{% url 'admin:password_change' %}">{% trans 'Change password' %}</a> /
{% endif %}
<a href="{% url 'admin:logout' %}">{% trans 'Log out' %}</a>
{% endblock %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment