Skip to content

Instantly share code, notes, and snippets.

Avatar

Teury Diaz teury

View GitHub Profile
@teury
teury / language_query_string.py
Last active Nov 9, 2019
Django Middleware language change query string ?hl=langcode
View language_query_string.py
import django
from django.utils import translation
from django.shortcuts import redirect, reverse
def is_django_greater_than_1_10():
main_version = django.VERSION[0]
if main_version > 1:
return True
@teury
teury / config.py
Created Jan 31, 2018 — forked from jerivas/config.py
One-click Django language select
View config.py
# settings.py
TEMPLATE_CONTEXT_PROCESSORS = (
'django.core.context_processors.i18n',
)
# urls.py (outside i18n_patterns)
(r'^i18n/', include('django.conf.urls.i18n')),
You can’t perform that action at this time.