diff --git a/dashboard/views.py b/dashboard/views.py index c9ede9c..71ced9f 100644 --- a/dashboard/views.py +++ b/dashboard/views.py @@ -27,14 +27,19 @@ from django.urls import reverse #import datetime as DT #from django.db.models import Q +from django.contrib import messages +from django.utils.translation import gettext as _ + #from .forms import SourceForm, DestinationForm, PostForm, MoverForm, ClaimForm, SourceLoginForm, MoverLoginForm, CustomFormDestination #from .models import Source, Destination, Post, Mover, Claim + def dashboard(request): - return render(request, 'dashboard/index.html', {}) + #messages.info(request, 'Three credits remain in your account.') + return render(request, 'dashboard/index.html') def unused(request): - return HttpResponse("Hello, world.") + return HttpResponse(_("Hello, world.")) # def sources(request): # sources = Source.objects.all() diff --git a/procat2/settings.py b/procat2/settings.py index da0184d..337113a 100644 --- a/procat2/settings.py +++ b/procat2/settings.py @@ -46,6 +46,7 @@ MIDDLEWARE = [ 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'django.middleware.locale.LocaleMiddleware', 'procat2.middleware.SetApplicationName', ] @@ -102,18 +103,12 @@ AUTH_PASSWORD_VALIDATORS = [ }, ] - # Internationalization # https://docs.djangoproject.com/en/2.1/topics/i18n/ - LANGUAGE_CODE = 'en-us' - TIME_ZONE = 'UTC' - USE_I18N = True - USE_L10N = True - USE_TZ = True diff --git a/procat2/urls.py b/procat2/urls.py index ee610d0..4f1352a 100644 --- a/procat2/urls.py +++ b/procat2/urls.py @@ -19,7 +19,7 @@ from django.urls import include, path from dashboard.views import dashboard urlpatterns = [ - path('', dashboard, name='root'), + path('', dashboard, name='home'), path('dashboard', dashboard, name='dashboard'), path('admin/', admin.site.urls), path('accounts/', include('django.contrib.auth.urls')), diff --git a/templates/dashboard/index.html b/templates/dashboard/index.html index 12902ad..13d5bc9 100644 --- a/templates/dashboard/index.html +++ b/templates/dashboard/index.html @@ -1,7 +1,9 @@ {% extends 'base.html' %} +{% load i18n %} -{% block title %}Dashboard{% endblock %} +{% block title %} trans "Dashboard"{% endblock %} {% block content %} -