0.1.1 fix lang
This commit is contained in:
@@ -4,6 +4,7 @@ from django.conf.urls.static import static
|
||||
from django.conf import settings
|
||||
from .js_views import *
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path('get_content_for_section/', get_content_for_section_ajax, name='get_content_for_section_ajax'),
|
||||
# path('page/<str:url>/', StaticPageView, name='static_page'),
|
||||
|
||||
@@ -14,6 +14,8 @@ from datetime import datetime
|
||||
from django.template.loader import render_to_string
|
||||
from django.urls import reverse
|
||||
from .funcs import *
|
||||
from django.utils.translation import activate, get_language_info
|
||||
|
||||
|
||||
def get_content_for_section_ajax(request):
|
||||
|
||||
@@ -26,6 +28,9 @@ def get_content_for_section_ajax(request):
|
||||
if not data and request.body:
|
||||
data = json.loads(request.body)
|
||||
|
||||
if 'lang' in data:
|
||||
activate(data['lang'])
|
||||
|
||||
if 'screen_width' in data and data['screen_width']:
|
||||
request.session['screen_width'] = data['screen_width']
|
||||
|
||||
|
||||
Reference in New Issue
Block a user