Update main page

This commit is contained in:
Mario Hüttel 2022-01-01 22:47:12 +01:00
parent dbbd8b4a99
commit a29dc5b97c
2 changed files with 18 additions and 0 deletions

View File

@ -92,6 +92,12 @@ class MainView(BaseTemplateMixin, TemplateView):
navbar_selected = 'Main' navbar_selected = 'Main'
base_title = 'Main' base_title = 'Main'
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context['user'] = self.request.user
return context
def logout_view(request): def logout_view(request):
logout(request) logout(request)
return redirect('parts-main') return redirect('parts-main')

View File

@ -1,5 +1,17 @@
{% extends 'base.html' %} {% extends 'base.html' %}
{% block content %} {% block content %}
{% if user.is_authenticated %}
Hi Hi
{% else %}
<section class="bg-dark text-light p-5 text-center">
<div class="container">
<div class="d-sm-flex">
<div>
<h1>Shimatta Stock Management System. <a href="{% url 'login' %}" class="text-decoration-none text-warning">Login now</a>.</h1>
</div>
</div>
</div>
</section>
{% endif %}
{% endblock content %} {% endblock content %}