From 3c6d5756c57976882041cab912b5ab475cfd2a6d Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Tue, 14 May 2019 13:21:20 +1000 Subject: [PATCH] Create a simple user settings view --- InvenTree/InvenTree/urls.py | 4 +++- InvenTree/InvenTree/views.py | 7 +++++++ InvenTree/templates/InvenTree/settings.html | 21 +++++++++++++++++++++ InvenTree/templates/navbar.html | 2 ++ 4 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 InvenTree/templates/InvenTree/settings.html diff --git a/InvenTree/InvenTree/urls.py b/InvenTree/InvenTree/urls.py index fe8a624458..572225864f 100644 --- a/InvenTree/InvenTree/urls.py +++ b/InvenTree/InvenTree/urls.py @@ -30,7 +30,7 @@ from django.conf.urls.static import static from django.views.generic.base import RedirectView 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 @@ -61,6 +61,8 @@ urlpatterns = [ 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'^settings/', SettingsView.as_view(), name='settings'), url(r'^admin/', admin.site.urls, name='inventree-admin'), diff --git a/InvenTree/InvenTree/views.py b/InvenTree/InvenTree/views.py index 08ca9e0eb5..aea938f961 100644 --- a/InvenTree/InvenTree/views.py +++ b/InvenTree/InvenTree/views.py @@ -414,3 +414,10 @@ class SearchView(TemplateView): context['query'] = query return super(TemplateView, self).render_to_response(context) + + +class SettingsView(TemplateView): + """ View for configuring User settings + """ + + template_name = "InvenTree/settings.html" diff --git a/InvenTree/templates/InvenTree/settings.html b/InvenTree/templates/InvenTree/settings.html new file mode 100644 index 0000000000..99aa03ccb1 --- /dev/null +++ b/InvenTree/templates/InvenTree/settings.html @@ -0,0 +1,21 @@ +{% extends "base.html" %} + +{% block page_title %} +InvenTree | Settings +{% endblock %} + +{% block content %} +

Settings

+
+ +Logged in as {{ user.username }} + +{% endblock %} + +{% block js_load %} +{{ block.super }} +{% endblock %} + +{% block js_ready %} +{{ block.super }} +{% endblock %} \ No newline at end of file diff --git a/InvenTree/templates/navbar.html b/InvenTree/templates/navbar.html index 53a7bb4894..5cb71d13ac 100644 --- a/InvenTree/templates/navbar.html +++ b/InvenTree/templates/navbar.html @@ -19,7 +19,9 @@ {% if user.is_authenticated %} {% if user.is_staff %}
  • Admin
  • +
    {% endif %} +
  • Settings
  • Logout
  • {% else %}
  • Login