diff --git a/gas/templates/gas/base.html b/gas/templates/gas/base.html index 26677be..efb7021 100644 --- a/gas/templates/gas/base.html +++ b/gas/templates/gas/base.html @@ -15,7 +15,7 @@ {% if not is_popup %} - + {{ user }} @@ -41,7 +41,7 @@ {% if not is_popup %} - + {% for bc_url, bc_label in breadcrumbs %} {% if bc_url %} {{ bc_label }} diff --git a/gas/tests/test_views.py b/gas/tests/test_views.py index 068e68a..eb0864f 100644 --- a/gas/tests/test_views.py +++ b/gas/tests/test_views.py @@ -228,10 +228,14 @@ class GASMixinTestCase(TestCase): ] template_name = 'gas/base.html' + def get_home_url(self): + return 'home_url' + view = SampleView.as_view() request = self.request_factory.get('some_url') request.user = self.admin_user response = view(request) + self.assertEqual(response.context_data['home_url'], 'home_url') 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) @@ -428,7 +432,7 @@ class GASDeleteTestCase(TestCase): success_url = 'success' confirmation_text = 'delete {object.username}' deleted_text = '{object.username} deleted' - + view = SampleDeleteView.as_view() request = request_factory.get('some_url') diff --git a/gas/views.py b/gas/views.py index 938bf7b..64c22f6 100644 --- a/gas/views.py +++ b/gas/views.py @@ -110,6 +110,10 @@ class GASMixin: def get_success_message(self): return self.success_message + def get_home_url(self): + """ Url for the home of the control panel """ + return reverse('gas:index') + def get_cancel_url(self): if self.cancel_url: # Forcing possible reverse_lazy evaluation @@ -154,6 +158,7 @@ class GASMixin: js = js + gas_settings.EXTRA_MEDIA.get('js', []) ctx.update({ 'base_template': self.base_template, + 'home_url': self.get_home_url(), 'header_title': self.get_header_title(), 'title': self.get_title(), 'help_text': self.get_help_text(), diff --git a/runtests.py b/runtests.py index 6a4e1c9..f697bf4 100755 --- a/runtests.py +++ b/runtests.py @@ -10,6 +10,7 @@ def runtests(): if not settings.configured: # Configure test environment settings.configure( + SECRET_KEY="test-secret", DATABASES={ 'default': { 'ENGINE': 'django.db.backends.sqlite3',