Fix login view
This commit is contained in:
parent
873e8cc043
commit
2fa7401d58
|
@ -6,14 +6,30 @@ from django.views.generic import TemplateView
|
||||||
|
|
||||||
from gas.views import GASMixin
|
from gas.views import GASMixin
|
||||||
|
|
||||||
|
from gas import gas_settings
|
||||||
|
|
||||||
class GASLoginView(GASMixin, LoginView):
|
|
||||||
|
class GASLoginView(LoginView):
|
||||||
template_name = "gas/login.html"
|
template_name = "gas/login.html"
|
||||||
|
|
||||||
def get_success_url(self):
|
def get_success_url(self):
|
||||||
url = self.get_redirect_url()
|
url = self.get_redirect_url()
|
||||||
return url or resolve_url('gas:index')
|
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):
|
class GASPasswordChangeView(GASMixin, PasswordChangeView):
|
||||||
template_name = 'gas/base_form.html'
|
template_name = 'gas/base_form.html'
|
||||||
|
@ -21,6 +37,7 @@ class GASPasswordChangeView(GASMixin, PasswordChangeView):
|
||||||
title = _('Change your password')
|
title = _('Change your password')
|
||||||
success_message = _('Password changed.')
|
success_message = _('Password changed.')
|
||||||
|
|
||||||
|
|
||||||
class Index(GASMixin, TemplateView):
|
class Index(GASMixin, TemplateView):
|
||||||
main_menu = 'index'
|
main_menu = 'index'
|
||||||
template_name = "gas/index.html"
|
template_name = "gas/index.html"
|
||||||
|
|
Loading…
Reference in New Issue