From 2fa7401d58911737bba43a86018da4f09e9747b6 Mon Sep 17 00:00:00 2001 From: shagi Date: Wed, 12 May 2021 16:11:06 +0200 Subject: [PATCH] Fix login view --- gas/gas/core/views.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/gas/gas/core/views.py b/gas/gas/core/views.py index e4b62a1..3700eeb 100644 --- a/gas/gas/core/views.py +++ b/gas/gas/core/views.py @@ -6,14 +6,30 @@ from django.views.generic import TemplateView from gas.views import GASMixin +from gas import gas_settings -class GASLoginView(GASMixin, LoginView): + +class GASLoginView(LoginView): template_name = "gas/login.html" def get_success_url(self): url = self.get_redirect_url() return url or resolve_url('gas:index') + def get_context_data(self, **kwargs): + ctx = super().get_context_data(**kwargs) + css = gas_settings.MEDIA['css'] + js = gas_settings.MEDIA['js'] + if gas_settings.EXTRA_MEDIA: + css = css + gas_settings.EXTRA_MEDIA.get('css', []) + js = js + gas_settings.EXTRA_MEDIA.get('js', []) + ctx.update({ + 'logo_static_url': gas_settings.LOGO, + 'css': css, + 'js': js, + }) + return ctx + class GASPasswordChangeView(GASMixin, PasswordChangeView): template_name = 'gas/base_form.html' @@ -21,6 +37,7 @@ class GASPasswordChangeView(GASMixin, PasswordChangeView): title = _('Change your password') success_message = _('Password changed.') + class Index(GASMixin, TemplateView): main_menu = 'index' template_name = "gas/index.html"