refactor for new lots urls

This commit is contained in:
Thomas Nahuel Rusiecki 2025-02-26 23:47:44 -03:00
parent 46ca01f7d5
commit 034df9941a
5 changed files with 9 additions and 9 deletions

View file

@ -78,7 +78,7 @@
{% endfor %}
</div>
<div class="container">
<a class="btn btn-grey" href="{% url 'dashboard:unassigned' %}">{% translate "Cancel" %}</a>
<a class="btn btn-grey" href="{% url 'lot:unassigned' %}">{% translate "Cancel" %}</a>
<input class="btn btn-green-admin" type="submit" name="submit" value="{% translate 'Save' %}" />
</div>

View file

@ -9,7 +9,7 @@
{% if lot.type == tag %}
<div class="row mb-3">
<div class="col">
<a href="{% url 'dashboard:lot' lot.id %}">{{ lot.name }}
<a href="{% url 'lot:lot' lot.id %}">{{ lot.name }}
</a>
</div>
</div>

View file

@ -40,7 +40,7 @@ class NewDeviceView(DashboardView, FormView):
template_name = "new_device.html"
title = _("New Device")
breadcrumb = "Device / New Device"
success_url = reverse_lazy('dashboard:unassigned')
success_url = reverse_lazy('lot:unassigned')
form_class = DeviceFormSet
def form_valid(self, form):
@ -57,7 +57,7 @@ class EditDeviceView(DashboardView, UpdateView):
template_name = "new_device.html"
title = _("Update Device")
breadcrumb = "Device / Update Device"
success_url = reverse_lazy('dashboard:unassigned_devices')
success_url = reverse_lazy('lot:unassigned_devices')
model = SystemProperty
def get_form_kwargs(self):
@ -74,7 +74,6 @@ class EditDeviceView(DashboardView, UpdateView):
class DetailsView(DashboardView, TemplateView):
template_name = "details.html"
title = _("Device")
breadcrumb = "Device / Details"
model = SystemProperty
@ -113,6 +112,7 @@ class DetailsView(DashboardView, TemplateView):
device_notes = Note.objects.filter(snapshot_uuid__in=uuids).order_by('-date')
context.update({
'object': self.object,
'title': _("Device {}".format(self.object.shortid)),
'snapshot': last_evidence,
'lot_tags': lot_tags,
'dpps': dpps,

View file

@ -22,7 +22,7 @@
{% bootstrap_form form alert_error_type="none" error_css_class="alert alert-danger alert-icon alert-icon-border" %}
<div class="form-actions-no-box">
<a class="btn btn-grey" href="{% url 'dashboard:unassigned' %}">{% translate "Cancel" %}</a>
<a class="btn btn-grey" href="{% url 'lot:unassigned' %}">{% translate "Cancel" %}</a>
<input class="btn btn-green-admin" type="submit" name="submit" value="{% translate 'Save' %}" />
</div>

View file

@ -17,17 +17,17 @@ class LoginView(auth_views.LoginView):
template_name = 'login.html'
extra_context = {
'title': _('Login'),
'success_url': reverse_lazy('dashboard:unassigned'),
'success_url': reverse_lazy('lot:unassigned'),
'commit_id': settings.COMMIT,
}
def get(self, request, *args, **kwargs):
self.extra_context['success_url'] = request.GET.get(
'next',
reverse_lazy('dashboard:unassigned')
reverse_lazy('lot:unassigned')
)
if not self.request.user.is_anonymous:
return redirect(reverse_lazy('dashboard:unassigned'))
return redirect(reverse_lazy('lot:unassigned'))
return super().get(request, *args, **kwargs)