mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-25 08:46:10 -06:00
Reorganize account view templates
This commit is contained in:
parent
dd70ba9470
commit
6a5c44f237
@ -1,4 +1,4 @@
|
|||||||
{% extends 'users/base_profile.html' %}
|
{% extends 'users/account/base.html' %}
|
||||||
{% load helpers %}
|
{% load helpers %}
|
||||||
{% load render_table from django_tables2 %}
|
{% load render_table from django_tables2 %}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
{% extends 'users/base_profile.html' %}
|
{% extends 'users/account/base.html' %}
|
||||||
{% load buttons %}
|
{% load buttons %}
|
||||||
{% load helpers %}
|
{% load helpers %}
|
||||||
{% load render_table from django_tables2 %}
|
{% load render_table from django_tables2 %}
|
@ -1,4 +1,4 @@
|
|||||||
{% extends 'users/base_profile.html' %}
|
{% extends 'users/account/base.html' %}
|
||||||
{% load form_helpers %}
|
{% load form_helpers %}
|
||||||
|
|
||||||
{% block title %}Change Password{% endblock %}
|
{% block title %}Change Password{% endblock %}
|
@ -1,4 +1,4 @@
|
|||||||
{% extends 'users/base_profile.html' %}
|
{% extends 'users/account/base.html' %}
|
||||||
{% load helpers %}
|
{% load helpers %}
|
||||||
{% load form_helpers %}
|
{% load form_helpers %}
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
{% extends 'users/base_profile.html' %}
|
{% extends 'users/account/base.html' %}
|
||||||
{% load helpers %}
|
{% load helpers %}
|
||||||
{% load render_table from django_tables2 %}
|
{% load render_table from django_tables2 %}
|
||||||
|
|
@ -1,11 +0,0 @@
|
|||||||
{% extends 'generic/object.html' %}
|
|
||||||
{% load buttons %}
|
|
||||||
{% load static %}
|
|
||||||
{% load helpers %}
|
|
||||||
{% load plugins %}
|
|
||||||
|
|
||||||
{% block content-wrapper %}
|
|
||||||
<div class="tab-content">
|
|
||||||
{% block content %}{% endblock %}
|
|
||||||
</div>
|
|
||||||
{% endblock %}
|
|
@ -1,4 +1,4 @@
|
|||||||
{% extends 'users/base.html' %}
|
{% extends 'generic/object.html' %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load helpers %}
|
{% load helpers %}
|
||||||
{% load render_table from django_tables2 %}
|
{% load render_table from django_tables2 %}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
{% extends 'users/base.html' %}
|
{% extends 'generic/object.html' %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load helpers %}
|
{% load helpers %}
|
||||||
{% load render_table from django_tables2 %}
|
{% load render_table from django_tables2 %}
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
{% extends 'users/base_profile.html' %}
|
|
||||||
{% load i18n %}
|
|
||||||
{% load form_helpers %}
|
|
||||||
|
|
||||||
{% block title %}{% trans "Change Password" %}{% endblock %}
|
|
||||||
|
|
||||||
{% block tabs %}
|
|
||||||
<ul class="nav nav-tabs px-3">
|
|
||||||
<li role="presentation" class="nav-item">
|
|
||||||
<a class="nav-link{% if active_tab == 'password' %} active{% endif %}" href="{% url 'users:change_user_password' pk=object.pk %}">{% trans "Password" %}</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
{% endblock tabs %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<form action="." method="post" class="form form-horizontal col-md-8 offset-md-2">
|
|
||||||
{% csrf_token %}
|
|
||||||
<div class="field-group">
|
|
||||||
<h5 class="text-center">{% trans "Password" %}</h5>
|
|
||||||
{% render_field form.new_password1 %}
|
|
||||||
{% render_field form.new_password2 %}
|
|
||||||
</div>
|
|
||||||
<div class="text-end">
|
|
||||||
<a href="{% url 'users:profile' %}" class="btn btn-outline-danger">{% trans "Cancel" %}</a>
|
|
||||||
<button type="submit" name="_update" class="btn btn-primary">{% trans "Save" %}</button>
|
|
||||||
</div>
|
|
||||||
</form>
|
|
||||||
{% endblock %}
|
|
@ -1,4 +1,4 @@
|
|||||||
{% extends 'users/base.html' %}
|
{% extends 'generic/object.html' %}
|
||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
{% load helpers %}
|
{% load helpers %}
|
||||||
{% load render_table from django_tables2 %}
|
{% load render_table from django_tables2 %}
|
||||||
|
@ -6,11 +6,14 @@ from . import views
|
|||||||
app_name = 'users'
|
app_name = 'users'
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
|
||||||
# User
|
# Account views
|
||||||
path('profile/', views.ProfileView.as_view(), name='profile'),
|
path('profile/', views.ProfileView.as_view(), name='profile'),
|
||||||
path('bookmarks/', views.BookmarkListView.as_view(), name='bookmarks'),
|
path('bookmarks/', views.BookmarkListView.as_view(), name='bookmarks'),
|
||||||
path('preferences/', views.UserConfigView.as_view(), name='preferences'),
|
path('preferences/', views.UserConfigView.as_view(), name='preferences'),
|
||||||
path('password/', views.ChangePasswordView.as_view(), name='change_password'),
|
path('password/', views.ChangePasswordView.as_view(), name='change_password'),
|
||||||
|
path('api-tokens/', views.TokenListView.as_view(), name='token_list'),
|
||||||
|
path('api-tokens/add/', views.TokenEditView.as_view(), name='token_add'),
|
||||||
|
path('api-tokens/<int:pk>/', include(get_model_urls('users', 'token'))),
|
||||||
|
|
||||||
# Users
|
# Users
|
||||||
path('users/', views.NetBoxUserListView.as_view(), name='netboxuser_list'),
|
path('users/', views.NetBoxUserListView.as_view(), name='netboxuser_list'),
|
||||||
@ -34,9 +37,4 @@ urlpatterns = [
|
|||||||
path('permissions/delete/', views.ObjectPermissionBulkDeleteView.as_view(), name='objectpermission_bulk_delete'),
|
path('permissions/delete/', views.ObjectPermissionBulkDeleteView.as_view(), name='objectpermission_bulk_delete'),
|
||||||
path('permissions/<int:pk>/', include(get_model_urls('users', 'objectpermission'))),
|
path('permissions/<int:pk>/', include(get_model_urls('users', 'objectpermission'))),
|
||||||
|
|
||||||
# API tokens
|
|
||||||
path('api-tokens/', views.TokenListView.as_view(), name='token_list'),
|
|
||||||
path('api-tokens/add/', views.TokenEditView.as_view(), name='token_add'),
|
|
||||||
path('api-tokens/<int:pk>/', include(get_model_urls('users', 'token'))),
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
@ -158,7 +158,7 @@ class LogoutView(View):
|
|||||||
#
|
#
|
||||||
|
|
||||||
class ProfileView(LoginRequiredMixin, View):
|
class ProfileView(LoginRequiredMixin, View):
|
||||||
template_name = 'users/profile.html'
|
template_name = 'users/account/profile.html'
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
|
|
||||||
@ -177,7 +177,7 @@ class ProfileView(LoginRequiredMixin, View):
|
|||||||
|
|
||||||
|
|
||||||
class UserConfigView(LoginRequiredMixin, View):
|
class UserConfigView(LoginRequiredMixin, View):
|
||||||
template_name = 'users/preferences.html'
|
template_name = 'users/account/preferences.html'
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
userconfig = request.user.config
|
userconfig = request.user.config
|
||||||
@ -205,7 +205,7 @@ class UserConfigView(LoginRequiredMixin, View):
|
|||||||
|
|
||||||
|
|
||||||
class ChangePasswordView(LoginRequiredMixin, View):
|
class ChangePasswordView(LoginRequiredMixin, View):
|
||||||
template_name = 'users/password.html'
|
template_name = 'users/account/password.html'
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
# LDAP users cannot change their password here
|
# LDAP users cannot change their password here
|
||||||
@ -240,7 +240,7 @@ class ChangePasswordView(LoginRequiredMixin, View):
|
|||||||
|
|
||||||
class BookmarkListView(LoginRequiredMixin, generic.ObjectListView):
|
class BookmarkListView(LoginRequiredMixin, generic.ObjectListView):
|
||||||
table = BookmarkTable
|
table = BookmarkTable
|
||||||
template_name = 'users/bookmarks.html'
|
template_name = 'users/account/bookmarks.html'
|
||||||
|
|
||||||
def get_queryset(self, request):
|
def get_queryset(self, request):
|
||||||
return Bookmark.objects.filter(user=request.user)
|
return Bookmark.objects.filter(user=request.user)
|
||||||
@ -263,7 +263,7 @@ class TokenListView(LoginRequiredMixin, View):
|
|||||||
table = tables.TokenTable(tokens)
|
table = tables.TokenTable(tokens)
|
||||||
table.configure(request)
|
table.configure(request)
|
||||||
|
|
||||||
return render(request, 'users/api_tokens.html', {
|
return render(request, 'users/account/api_tokens.html', {
|
||||||
'tokens': tokens,
|
'tokens': tokens,
|
||||||
'active_tab': 'api-tokens',
|
'active_tab': 'api-tokens',
|
||||||
'table': table,
|
'table': table,
|
||||||
@ -307,7 +307,7 @@ class TokenEditView(LoginRequiredMixin, View):
|
|||||||
messages.success(request, msg)
|
messages.success(request, msg)
|
||||||
|
|
||||||
if not pk and not settings.ALLOW_TOKEN_RETRIEVAL:
|
if not pk and not settings.ALLOW_TOKEN_RETRIEVAL:
|
||||||
return render(request, 'users/api_token.html', {
|
return render(request, 'users/account/api_token.html', {
|
||||||
'object': token,
|
'object': token,
|
||||||
'key': token.key,
|
'key': token.key,
|
||||||
'return_url': reverse('users:token_list'),
|
'return_url': reverse('users:token_list'),
|
||||||
|
Loading…
Reference in New Issue
Block a user