admin lot tags #47
|
@ -115,24 +115,17 @@
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="admin {% if path == 'unassigned_devices' %}active {% endif %}nav-link fw-bold" data-bs-toggle="collapse" data-bs-target="#ul_devices" aria-expanded="false" aria-controls="ul_devices" href="javascript:void()">
|
<a class="admin {% if path == 'tag' or path in 'unassigned dashboard' %}active {% endif %}nav-link fw-bold" data-bs-toggle="collapse" data-bs-target="#ul_lots" aria-expanded="false" aria-controls="ul_lots" href="javascript:void()">
|
||||||
<i class="bi bi-laptop icon_sidebar"></i>
|
|
||||||
{% trans 'Devices' %}
|
|
||||||
</a>
|
|
||||||
<ul class="flex-column mb-2 ul_sidebar accordion-collapse {% if path == 'unassigned_devices' %}expanded{% else %}collapse{% endif %}" id="ul_devices" data-bs-parent="#sidebarMenu">
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link{% if path == 'unassigned_devices' %} active2{% endif %}" href="{% url 'dashboard:unassigned_devices' %}">
|
|
||||||
{% trans 'Unassigned devices' %}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="admin {% if path == 'tags' or path == 'lot' %}active {% endif %}nav-link fw-bold" data-bs-toggle="collapse" data-bs-target="#ul_lots" aria-expanded="false" aria-controls="ul_lots" href="javascript:void()">
|
|
||||||
<i class="bi bi-database icon_sidebar"></i>
|
<i class="bi bi-database icon_sidebar"></i>
|
||||||
{% trans 'Lots' %}
|
{% trans 'Lots' %}
|
||||||
</a>
|
</a>
|
||||||
<ul class="flex-column mb-2 ul_sidebar accordion-collapse {% if path == 'tags' or path == 'lot' %}expanded{% else %}collapse{% endif %}" id="ul_lots" data-bs-parent="#sidebarMenu">
|
<ul class="flex-column mb-2 ul_sidebar accordion-collapse {% if path == 'tag' or path in 'unassigned dashboard' %}expanded{% else %}collapse{% endif %}" id="ul_lots" data-bs-parent="#sidebarMenu">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link{% if path == 'unassigned' %} active2{% endif %}" href="{% url 'dashboard:unassigned' %}">
|
||||||
|
{% trans 'Unassigned' %}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
{% for tag in lot_tags %}
|
{% for tag in lot_tags %}
|
||||||
<li class="nav-items">
|
<li class="nav-items">
|
||||||
<a class="nav-link{% if path == 'tags' %} active2{% endif %}" href="{% url 'lot:tags' tag.id %}">
|
<a class="nav-link{% if path == 'tags' %} active2{% endif %}" href="{% url 'lot:tags' tag.id %}">
|
||||||
|
@ -143,29 +136,21 @@
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="admin {% if path in 'upload list' %}active {% endif %}nav-link fw-bold" data-bs-toggle="collapse" data-bs-target="#ul_evidences" aria-expanded="false" aria-controls="ul_evidences" href="javascript:void()">
|
<a class="admin {% if path in 'upload list import add' %}active {% endif %}nav-link fw-bold" data-bs-toggle="collapse" data-bs-target="#ul_evidences" aria-expanded="false" aria-controls="ul_evidences" href="javascript:void()">
|
||||||
<i class="bi bi-usb-drive icon_sidebar"></i>
|
<i class="bi bi-usb-drive icon_sidebar"></i>
|
||||||
{% trans 'Evidences' %}
|
{% trans 'Evidences' %}
|
||||||
</a>
|
</a>
|
||||||
<ul class="flex-column mb-2 ul_sidebar accordion-collapse {% if path in 'upload list' %}expanded{% else %}collapse{% endif %}" id="ul_evidences" data-bs-parent="#sidebarMenu">
|
<ul class="flex-column mb-2 ul_sidebar accordion-collapse {% if path in 'upload list import add' %}expanded{% else %}collapse{% endif %}" id="ul_evidences" data-bs-parent="#sidebarMenu">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link{% if path == 'list' %} active2{% endif %}" href="{% url 'evidence:list' %}">
|
||||||
|
{% trans 'List of evidences' %}
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link{% if path == 'upload' %} active2{% endif %}" href="{% url 'evidence:upload' %}">
|
<a class="nav-link{% if path == 'upload' %} active2{% endif %}" href="{% url 'evidence:upload' %}">
|
||||||
{% trans 'Upload one' %}
|
{% trans 'Upload one' %}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
|
||||||
<a class="nav-link{% if path == 'list' %} active2{% endif %}" href="{% url 'evidence:list' %}">
|
|
||||||
{% trans 'Old evidences' %}
|
|
||||||
</a>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li class="nav-item">
|
|
||||||
<a class="admin {% if path in 'import add' %}active {% endif %}nav-link fw-bold" data-bs-toggle="collapse" data-bs-target="#ul_placeholders" aria-expanded="false" aria-controls="ul_placeholders" href="javascript:void()">
|
|
||||||
<i class="bi-menu-button-wide icon_sidebar"></i>
|
|
||||||
{% trans 'Placeholders' %}
|
|
||||||
</a>
|
|
||||||
<ul class="flex-column mb-2 ul_sidebar accordion-collapse {% if path in 'import add' %}expanded{% else %}collapse{% endif %}" id="ul_placeholders" data-bs-parent="#sidebarMenu">
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link{% if path == 'import' %} active2{% endif %}" href="{% url 'evidence:import' %}">
|
<a class="nav-link{% if path == 'import' %} active2{% endif %}" href="{% url 'evidence:import' %}">
|
||||||
{% trans 'Upload Spreadsheet' %}
|
{% trans 'Upload Spreadsheet' %}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
from dashboard import views
|
from dashboard import views
|
||||||
|
|
||||||
app_name = 'dashboard'
|
app_name = 'dashboard'
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path("", views.UnassignedDevicesView.as_view(), name="unassigned_devices"),
|
path("", views.UnassignedDevicesView.as_view(), name="unassigned"),
|
||||||
path("<int:pk>/", views.LotDashboardView.as_view(), name="lot"),
|
path("<int:pk>/", views.LotDashboardView.as_view(), name="lot"),
|
||||||
path("search", views.SearchView.as_view(), name="search"),
|
path("search", views.SearchView.as_view(), name="search"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<a class="btn btn-grey" href="{% url 'dashboard:unassigned_devices' %}">{% translate "Cancel" %}</a>
|
<a class="btn btn-grey" href="{% url 'dashboard:unassigned' %}">{% translate "Cancel" %}</a>
|
||||||
<input class="btn btn-green-admin" type="submit" name="submit" value="{% translate 'Save' %}" />
|
<input class="btn btn-green-admin" type="submit" name="submit" value="{% translate 'Save' %}" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class NewDeviceView(DashboardView, FormView):
|
||||||
template_name = "new_device.html"
|
template_name = "new_device.html"
|
||||||
title = _("New Device")
|
title = _("New Device")
|
||||||
breadcrumb = "Device / New Device"
|
breadcrumb = "Device / New Device"
|
||||||
success_url = reverse_lazy('dashboard:unassigned_devices')
|
success_url = reverse_lazy('dashboard:unassigned')
|
||||||
form_class = DeviceFormSet
|
form_class = DeviceFormSet
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
<!-- override invalid-feedback class -->
|
<!-- override invalid-feedback class -->
|
||||||
<style>
|
<style>
|
||||||
.invalid-feedback {
|
.invalid-feedback {
|
||||||
color: #670000;
|
color: #670000;
|
||||||
font-size: 1rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
{% bootstrap_form form alert_error_type="none" error_css_class="alert alert-danger alert-icon alert-icon-border" %}
|
{% bootstrap_form form alert_error_type="none" error_css_class="alert alert-danger alert-icon alert-icon-border" %}
|
||||||
<div class="form-actions-no-box">
|
<div class="form-actions-no-box">
|
||||||
<a class="btn btn-grey" href="{% url 'dashboard:unassigned_devices' %}">{% translate "Cancel" %}</a>
|
<a class="btn btn-grey" href="{% url 'dashboard:unassigned' %}">{% translate "Cancel" %}</a>
|
||||||
<input class="btn btn-green-admin" type="submit" name="submit" value="{% translate 'Save' %}" />
|
<input class="btn btn-green-admin" type="submit" name="submit" value="{% translate 'Save' %}" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -17,18 +17,18 @@ class LoginView(auth_views.LoginView):
|
||||||
template_name = 'login.html'
|
template_name = 'login.html'
|
||||||
extra_context = {
|
extra_context = {
|
||||||
'title': _('Login'),
|
'title': _('Login'),
|
||||||
'success_url': reverse_lazy('dashboard:unassigned_devices'),
|
'success_url': reverse_lazy('dashboard:unassigned'),
|
||||||
'commit_id': settings.COMMIT,
|
'commit_id': settings.COMMIT,
|
||||||
}
|
}
|
||||||
|
|
||||||
def get(self, request, *args, **kwargs):
|
def get(self, request, *args, **kwargs):
|
||||||
self.extra_context['success_url'] = request.GET.get(
|
self.extra_context['success_url'] = request.GET.get(
|
||||||
'next',
|
'next',
|
||||||
reverse_lazy('dashboard:unassigned_devices')
|
reverse_lazy('dashboard:unassigned')
|
||||||
)
|
)
|
||||||
if not self.request.user.is_anonymous:
|
if not self.request.user.is_anonymous:
|
||||||
return redirect(reverse_lazy('dashboard:unassigned_devices'))
|
return redirect(reverse_lazy('dashboard:unassigned'))
|
||||||
|
|
||||||
return super().get(request, *args, **kwargs)
|
return super().get(request, *args, **kwargs)
|
||||||
|
|
||||||
def form_valid(self, form):
|
def form_valid(self, form):
|
||||||
|
@ -72,4 +72,3 @@ class PasswordResetView(auth_views.PasswordResetView):
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
logger.error(err)
|
logger.error(err)
|
||||||
return HttpResponseRedirect(self.success_url)
|
return HttpResponseRedirect(self.success_url)
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% bootstrap_form form %}
|
{% bootstrap_form form %}
|
||||||
<div class="form-actions-no-box">
|
<div class="form-actions-no-box">
|
||||||
<a class="btn btn-grey" href="{% url 'dashboard:unassigned_devices' %}">{% translate "Cancel" %}</a>
|
<a class="btn btn-grey" href="{% url 'dashboard:unassigned' %}">{% translate "Cancel" %}</a>
|
||||||
<input class="btn btn-green-admin" type="submit" name="submit" value="{% translate 'Delete' %}" />
|
<input class="btn btn-green-admin" type="submit" name="submit" value="{% translate 'Delete' %}" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% bootstrap_form form %}
|
{% bootstrap_form form %}
|
||||||
<div class="form-actions-no-box">
|
<div class="form-actions-no-box">
|
||||||
<a class="btn btn-grey" href="{% url 'dashboard:unassigned_devices' %}">{% translate "Cancel" %}</a>
|
<a class="btn btn-grey" href="{% url 'dashboard:unassigned' %}">{% translate "Cancel" %}</a>
|
||||||
<input class="btn btn-green-admin" type="submit" name="submit" value="{% translate 'Save' %}" />
|
<input class="btn btn-green-admin" type="submit" name="submit" value="{% translate 'Save' %}" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
10
lot/views.py
10
lot/views.py
|
@ -18,7 +18,7 @@ class NewLotView(DashboardView, CreateView):
|
||||||
template_name = "new_lot.html"
|
template_name = "new_lot.html"
|
||||||
title = _("New lot")
|
title = _("New lot")
|
||||||
breadcrumb = "lot / New lot"
|
breadcrumb = "lot / New lot"
|
||||||
success_url = reverse_lazy('dashboard:unassigned_devices')
|
success_url = reverse_lazy('dashboard:unassigned')
|
||||||
model = Lot
|
model = Lot
|
||||||
fields = (
|
fields = (
|
||||||
"type",
|
"type",
|
||||||
|
@ -39,7 +39,7 @@ class DeleteLotView(DashboardView, DeleteView):
|
||||||
template_name = "delete_lot.html"
|
template_name = "delete_lot.html"
|
||||||
title = _("Delete lot")
|
title = _("Delete lot")
|
||||||
breadcrumb = "lot / Delete lot"
|
breadcrumb = "lot / Delete lot"
|
||||||
success_url = reverse_lazy('dashboard:unassigned_devices')
|
success_url = reverse_lazy('dashboard:unassigned')
|
||||||
model = Lot
|
model = Lot
|
||||||
fields = (
|
fields = (
|
||||||
"type",
|
"type",
|
||||||
|
@ -58,7 +58,7 @@ class EditLotView(DashboardView, UpdateView):
|
||||||
template_name = "new_lot.html"
|
template_name = "new_lot.html"
|
||||||
title = _("Edit lot")
|
title = _("Edit lot")
|
||||||
breadcrumb = "Lot / Edit lot"
|
breadcrumb = "Lot / Edit lot"
|
||||||
success_url = reverse_lazy('dashboard:unassigned_devices')
|
success_url = reverse_lazy('dashboard:unassigned')
|
||||||
model = Lot
|
model = Lot
|
||||||
fields = (
|
fields = (
|
||||||
"type",
|
"type",
|
||||||
|
@ -84,7 +84,7 @@ class AddToLotView(DashboardView, FormView):
|
||||||
template_name = "list_lots.html"
|
template_name = "list_lots.html"
|
||||||
title = _("Add to lots")
|
title = _("Add to lots")
|
||||||
breadcrumb = "lot / add to lots"
|
breadcrumb = "lot / add to lots"
|
||||||
success_url = reverse_lazy('dashboard:unassigned_devices')
|
success_url = reverse_lazy('dashboard:unassigned')
|
||||||
form_class = LotsForm
|
form_class = LotsForm
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
|
@ -125,7 +125,7 @@ class LotsTagsView(DashboardView, TemplateView):
|
||||||
template_name = "lots.html"
|
template_name = "lots.html"
|
||||||
title = _("lots")
|
title = _("lots")
|
||||||
breadcrumb = _("lots") + " /"
|
breadcrumb = _("lots") + " /"
|
||||||
success_url = reverse_lazy('dashboard:unassigned_devices')
|
success_url = reverse_lazy('dashboard:unassigned')
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
self.pk = kwargs.get('pk')
|
self.pk = kwargs.get('pk')
|
||||||
|
|
Loading…
Reference in a new issue