Fix login view

This commit is contained in:
Ales (Shagi) Zabala Alava 2021-05-12 16:11:06 +02:00
parent 873e8cc043
commit 2fa7401d58
1 changed files with 18 additions and 1 deletions

View File

@ -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"