From 754f75eab4d5c8736bac102fc0b85566a259036b Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Tue, 15 Mar 2022 14:33:27 +0100 Subject: [PATCH] Rename base URL 'inventory.devices' => 'inventory' --- ereuse_devicehub/inventory/views.py | 31 +++++++++---------- .../templates/ereuse_devicehub/base_site.html | 14 ++++----- .../templates/inventory/actions.html | 2 +- .../templates/inventory/addDeviceslot.html | 2 +- .../templates/inventory/addDevicestag.html | 2 +- .../templates/inventory/allocate.html | 2 +- .../templates/inventory/data_wipe.html | 2 +- .../templates/inventory/device_create.html | 6 ++-- .../templates/inventory/device_detail.html | 2 +- .../templates/inventory/device_list.html | 20 ++++++------ ereuse_devicehub/templates/inventory/lot.html | 4 +-- .../templates/inventory/removeDeviceslot.html | 2 +- .../templates/inventory/removelot.html | 2 +- .../templates/inventory/tag_create.html | 4 +-- .../inventory/tag_create_unnamed.html | 4 +-- .../templates/inventory/tag_detail.html | 6 ++-- .../templates/inventory/tag_list.html | 8 ++--- .../inventory/tag_unlink_device.html | 2 +- .../templates/inventory/trade.html | 2 +- .../templates/inventory/trade_document.html | 4 +-- .../templates/inventory/upload_snapshot.html | 6 ++-- ereuse_devicehub/views.py | 4 +-- 22 files changed, 64 insertions(+), 67 deletions(-) diff --git a/ereuse_devicehub/inventory/views.py b/ereuse_devicehub/inventory/views.py index 4ead3005..4e827be4 100644 --- a/ereuse_devicehub/inventory/views.py +++ b/ereuse_devicehub/inventory/views.py @@ -35,8 +35,7 @@ from ereuse_devicehub.resources.hash_reports import insert_hash from ereuse_devicehub.resources.lot.models import Lot from ereuse_devicehub.resources.tag.model import Tag -# TODO(@slamora): rename base 'inventory.devices' --> 'inventory' -devices = Blueprint('inventory.devices', __name__, url_prefix='/inventory') +devices = Blueprint('inventory', __name__, url_prefix='/inventory') logger = logging.getLogger(__name__) @@ -171,7 +170,7 @@ class LotDeviceAddView(View): else: messages.error('Error adding devices to lot!') - next_url = request.referrer or url_for('inventory.devices.devicelist') + next_url = request.referrer or url_for('inventory.devicelist') return flask.redirect(next_url) @@ -191,7 +190,7 @@ class LotDeviceDeleteView(View): else: messages.error('Error removing devices from lot!') - next_url = request.referrer or url_for('inventory.devices.devicelist') + next_url = request.referrer or url_for('inventory.devicelist') return flask.redirect(next_url) @@ -205,7 +204,7 @@ class LotCreateView(GenericMixView): form = LotForm() if form.validate_on_submit(): form.save() - next_url = url_for('inventory.devices.lotdevicelist', lot_id=form.id) + next_url = url_for('inventory.lotdevicelist', lot_id=form.id) return flask.redirect(next_url) lots = self.get_lots() @@ -228,7 +227,7 @@ class LotUpdateView(View): form = LotForm(id=id) if form.validate_on_submit(): form.save() - next_url = url_for('inventory.devices.lotdevicelist', lot_id=id) + next_url = url_for('inventory.lotdevicelist', lot_id=id) return flask.redirect(next_url) lots = Lot.query.filter(Lot.owner_id == current_user.id) @@ -251,11 +250,11 @@ class LotDeleteView(View): if form.instance.trade: msg = "Sorry, the lot cannot be deleted because have a trade action " messages.error(msg) - next_url = url_for('inventory.devices.lotdevicelist', lot_id=id) + next_url = url_for('inventory.lotdevicelist', lot_id=id) return flask.redirect(next_url) form.remove() - next_url = url_for('inventory.devices.devicelist') + next_url = url_for('inventory.devicelist') return flask.redirect(next_url) @@ -302,9 +301,9 @@ class DeviceCreateView(GenericMixView): } if form.validate_on_submit(): snapshot = form.save(commit=False) - next_url = url_for('inventory.devices.devicelist') + next_url = url_for('inventory.devicelist') if lot_id: - next_url = url_for('inventory.devices.lotdevicelist', lot_id=lot_id) + next_url = url_for('inventory.lotdevicelist', lot_id=lot_id) lot = lots.filter(Lot.id == lot_id).one() lot.devices.add(snapshot.device) db.session.add(lot) @@ -344,7 +343,7 @@ class TagAddView(View): form = TagForm() if form.validate_on_submit(): form.save() - next_url = url_for('inventory.devices.taglist') + next_url = url_for('inventory.taglist') return flask.redirect(next_url) return flask.render_template(self.template_name, form=form, **context) @@ -376,7 +375,7 @@ class TagAddUnnamedView(View): ) messages.error(msg) - next_url = url_for('inventory.devices.taglist') + next_url = url_for('inventory.taglist') return flask.redirect(next_url) return flask.render_template(self.template_name, form=form, **context) @@ -425,7 +424,7 @@ class TagUnlinkDeviceView(View): if form.validate_on_submit(): form.remove() - next_url = url_for('inventory.devices.devicelist') + next_url = url_for('inventory.devicelist') return flask.redirect(next_url) return flask.render_template( @@ -458,9 +457,9 @@ class NewActionView(View): lot_id = self.form.lot.data if lot_id: - return url_for('inventory.devices.lotdevicelist', lot_id=lot_id) + return url_for('inventory.lotdevicelist', lot_id=lot_id) - return url_for('inventory.devices.devicelist') + return url_for('inventory.devicelist') class NewAllocateView(NewActionView, DeviceListMix): @@ -542,7 +541,7 @@ class NewTradeDocumentView(View): if self.form.validate_on_submit(): self.form.save() messages.success('Document created successfully!') - next_url = url_for('inventory.devices.lotdevicelist', lot_id=lot_id) + next_url = url_for('inventory.lotdevicelist', lot_id=lot_id) return flask.redirect(next_url) return flask.render_template( diff --git a/ereuse_devicehub/templates/ereuse_devicehub/base_site.html b/ereuse_devicehub/templates/ereuse_devicehub/base_site.html index a84cea66..5d87be53 100644 --- a/ereuse_devicehub/templates/ereuse_devicehub/base_site.html +++ b/ereuse_devicehub/templates/ereuse_devicehub/base_site.html @@ -5,7 +5,7 @@