mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge branch 'login'
This commit is contained in:
commit
16b14c02d5
@ -1,5 +1,6 @@
|
||||
from django.conf.urls import url, include
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth import views as auth_views
|
||||
|
||||
from company.urls import company_urls
|
||||
|
||||
@ -34,9 +35,6 @@ apipatterns = [
|
||||
]
|
||||
|
||||
urlpatterns = [
|
||||
|
||||
url(r'^api-doc/', include_docs_urls(title='InvenTree API')),
|
||||
|
||||
url(r'^part/', include(part_urls)),
|
||||
url(r'^supplier-part/', include(supplier_part_urls)),
|
||||
|
||||
@ -46,11 +44,14 @@ urlpatterns = [
|
||||
|
||||
url(r'^build/', include(build_urls)),
|
||||
|
||||
url(r'^admin/', admin.site.urls),
|
||||
|
||||
url(r'^auth/', include('rest_framework.urls', namespace='rest_framework')),
|
||||
|
||||
url(r'^login/', auth_views.login, name='login'),
|
||||
url(r'^logout/', auth_views.logout, {'template_name': 'registration/logout.html'}, name='logout'),
|
||||
url(r'^admin/', admin.site.urls, name='inventree-admin'),
|
||||
|
||||
url(r'^api/', include(apipatterns)),
|
||||
url(r'^api-doc/', include_docs_urls(title='InvenTree API')),
|
||||
]
|
||||
|
||||
# Static file access
|
||||
|
@ -50,7 +50,7 @@
|
||||
{% endblock %}
|
||||
{% block js_load %}
|
||||
{{ block.super }}
|
||||
<script type='text/javacript' src="{% static script/inventree/stock.js' %}"></script>
|
||||
<script type='text/javacript' src="{% static 'script/inventree/stock.js' %}"></script>
|
||||
{% endblock %}
|
||||
{% block js_ready %}
|
||||
{{ block.super }}
|
||||
|
@ -11,5 +11,20 @@
|
||||
<li><a href="{% url 'build-index' %}">Build</a></li>
|
||||
<li><a href="{% url 'company-index' %}">Companies</a></li>
|
||||
</ul>
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
{% if user.is_authenticated %}
|
||||
<li class='dropdown'>
|
||||
<a class='dropdown-toggle' data-toggle='dropdown' href="#"><span class="glyphicon glyphicon-user"></span>{{ user.get_username }}</a>
|
||||
<ul class='dropdown-menu'>
|
||||
{% if user.is_staff %}
|
||||
<li><a href="/admin/">Admin</a></li>
|
||||
{% endif %}
|
||||
<li><a href="{% url 'logout' %}">Logout</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
{% else %}
|
||||
<li><a href="{% url 'login' %}"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
10
InvenTree/templates/registration/login.html
Normal file
10
InvenTree/templates/registration/login.html
Normal file
@ -0,0 +1,10 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Login</h2>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
{% endblock %}
|
7
InvenTree/templates/registration/logout.html
Normal file
7
InvenTree/templates/registration/logout.html
Normal file
@ -0,0 +1,7 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<h4>Logout</h4>
|
||||
<p>You have been logged out</p>
|
||||
<p>Click <a href="{% url 'login' %}">here</a> to log in</p>
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user