diff --git a/gas/gas/core/views.py b/gas/gas/core/views.py index 4c2ebbf..453ea55 100644 --- a/gas/gas/core/views.py +++ b/gas/gas/core/views.py @@ -1,6 +1,7 @@ from django.contrib.auth.views import LoginView, PasswordChangeView from django.shortcuts import resolve_url from django.urls import reverse_lazy +from django.utils.translation import gettext_lazy as _ from django.views.generic import TemplateView from gas.views import GASMixin @@ -17,7 +18,8 @@ class GASLoginView(LoginView): class GASPasswordChangeView(GASMixin, PasswordChangeView): template_name = 'gas/base_form.html' success_url = reverse_lazy('gas:index') - + title = _('Change your password') + success_message = _('Password changed.') class Index(GASMixin, TemplateView): main_menu = 'index' diff --git a/gas/gas/users/views.py b/gas/gas/users/views.py index 8bc79da..ffda20e 100644 --- a/gas/gas/users/views.py +++ b/gas/gas/users/views.py @@ -29,6 +29,7 @@ class BaseMixin: class UserList(BaseMixin, gviews.GASListView): template_name = 'gas/users/user_list.html' title = _('Users') + help_text = _('Manage users and set roles.') actions = [ (reverse_lazy('gas:user_create'), 'fa-plus', _('New user')), ] diff --git a/gas/templates/gas/base.html b/gas/templates/gas/base.html index a80b6f8..443ce1c 100644 --- a/gas/templates/gas/base.html +++ b/gas/templates/gas/base.html @@ -67,6 +67,13 @@ {% endfor %} {% endif %} + + {% block help_text %} + {% if help_text %} +

{{ help_text }}

+ {% endif %} + {% endblock %} + {% block content %} {% endblock %} diff --git a/gas/tests/test_views.py b/gas/tests/test_views.py index e3edf57..ec79cd0 100644 --- a/gas/tests/test_views.py +++ b/gas/tests/test_views.py @@ -193,6 +193,7 @@ class GASMixinTestCase(TestCase): class SampleView(gviews.GASMixin, TemplateView): title = 'title' header_title = 'header title' + help_text = 'help text' breadcrumbs = [ ('url', 'label'), ] @@ -204,6 +205,7 @@ class GASMixinTestCase(TestCase): response = view(request) self.assertEqual(response.context_data['title'], SampleView.title) self.assertEqual(response.context_data['header_title'], SampleView.header_title) + self.assertEqual(response.context_data['help_text'], SampleView.help_text) self.assertEqual(response.context_data['base_template'], SampleView.base_template) self.assertEqual(response.context_data['breadcrumbs'], SampleView.breadcrumbs) self.assertEqual(response.context_data['gas_title'], gas_settings.TITLE) diff --git a/gas/views.py b/gas/views.py index b6f748a..3108592 100644 --- a/gas/views.py +++ b/gas/views.py @@ -41,6 +41,7 @@ class GASMixin: continue_url = None header_title = '' title = '' + help_text = '' success_message = _("Operation successful.") breadcrumbs = [] @@ -84,6 +85,10 @@ class GASMixin: " Contents for page title. " return self.title + def get_help_text(self): + " Contents for page help. " + return self.help_text + def get_breadcrumbs(self): " Returns a list of (url, label) tuples for the breadcrumbs " return self.breadcrumbs @@ -94,6 +99,7 @@ class GASMixin: 'base_template': self.base_template, 'header_title': self.get_header_title(), 'title': self.get_title(), + 'help_text': self.get_help_text(), 'breadcrumbs': self.get_breadcrumbs(), 'gas_title': gas_settings.TITLE, 'logo_static_url': gas_settings.LOGO,