Create a simple user settings view

This commit is contained in:
Oliver Walters 2019-05-14 13:21:20 +10:00
parent 5a81372ead
commit 3c6d5756c5
4 changed files with 33 additions and 1 deletions

View File

@ -30,7 +30,7 @@ from django.conf.urls.static import static
from django.views.generic.base import RedirectView from django.views.generic.base import RedirectView
from rest_framework.documentation import include_docs_urls from rest_framework.documentation import include_docs_urls
from .views import IndexView, SearchView from .views import IndexView, SearchView, SettingsView
from users.urls import user_urls from users.urls import user_urls
@ -62,6 +62,8 @@ urlpatterns = [
url(r'^login/', auth_views.LoginView.as_view(), name='login'), url(r'^login/', auth_views.LoginView.as_view(), name='login'),
url(r'^logout/', auth_views.LogoutView.as_view(template_name='registration/logout.html'), name='logout'), url(r'^logout/', auth_views.LogoutView.as_view(template_name='registration/logout.html'), name='logout'),
url(r'^settings/', SettingsView.as_view(), name='settings'),
url(r'^admin/', admin.site.urls, name='inventree-admin'), url(r'^admin/', admin.site.urls, name='inventree-admin'),
url(r'^qr_code/', include(qr_code_urls, namespace='qr_code')), url(r'^qr_code/', include(qr_code_urls, namespace='qr_code')),

View File

@ -414,3 +414,10 @@ class SearchView(TemplateView):
context['query'] = query context['query'] = query
return super(TemplateView, self).render_to_response(context) return super(TemplateView, self).render_to_response(context)
class SettingsView(TemplateView):
""" View for configuring User settings
"""
template_name = "InvenTree/settings.html"

View File

@ -0,0 +1,21 @@
{% extends "base.html" %}
{% block page_title %}
InvenTree | Settings
{% endblock %}
{% block content %}
<h3>Settings</h3>
<hr>
Logged in as {{ user.username }}
{% endblock %}
{% block js_load %}
{{ block.super }}
{% endblock %}
{% block js_ready %}
{{ block.super }}
{% endblock %}

View File

@ -19,7 +19,9 @@
{% if user.is_authenticated %} {% if user.is_authenticated %}
{% if user.is_staff %} {% if user.is_staff %}
<li><a href="/admin/"><span class="glyphicon glyphicon-edit"></span> Admin</a></li> <li><a href="/admin/"><span class="glyphicon glyphicon-edit"></span> Admin</a></li>
<hr>
{% endif %} {% endif %}
<li><a href="{% url 'settings' %}"><span class="glyphicon glyphicon-cog"></span> Settings</a></li>
<li><a href="{% url 'logout' %}"><span class="glyphicon glyphicon-log-out"></span> Logout</a></li> <li><a href="{% url 'logout' %}"><span class="glyphicon glyphicon-log-out"></span> Logout</a></li>
{% else %} {% else %}
<li><a href="{% url 'login' %}"><span class="glyphicon glyphicon-log-in"></span> Login</a></li> <li><a href="{% url 'login' %}"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>