resolve conflict
This commit is contained in:
commit
71d30548cc
|
@ -10,14 +10,29 @@ from werkzeug.exceptions import NotFound
|
|||
|
||||
from ereuse_devicehub import messages
|
||||
from ereuse_devicehub.inventory.forms import (
|
||||
AllocateForm, DataWipeForm, LotDeviceForm, LotForm, NewActionForm,
|
||||
NewDeviceForm, TagDeviceForm, TagForm, TagUnnamedForm, TradeDocumentForm,
|
||||
TradeForm, UploadSnapshotForm)
|
||||
AllocateForm,
|
||||
DataWipeForm,
|
||||
LotDeviceForm,
|
||||
LotForm,
|
||||
NewActionForm,
|
||||
NewDeviceForm,
|
||||
TagDeviceForm,
|
||||
TagForm,
|
||||
TagUnnamedForm,
|
||||
TradeDocumentForm,
|
||||
TradeForm,
|
||||
UploadSnapshotForm
|
||||
)
|
||||
from ereuse_devicehub.resources.action.models import Trade
|
||||
from ereuse_devicehub.resources.device.models import (
|
||||
Computer, DataStorage, Device)
|
||||
Computer,
|
||||
DataStorage,
|
||||
Device
|
||||
)
|
||||
from ereuse_devicehub.resources.documents.device_row import (
|
||||
ActionRow, DeviceRow)
|
||||
ActionRow,
|
||||
DeviceRow
|
||||
)
|
||||
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
|
||||
|
@ -38,7 +53,7 @@ class DeviceListMix(View):
|
|||
lot = None
|
||||
tags = (
|
||||
Tag.query.filter(Tag.owner_id == current_user.id)
|
||||
.filter_by(device_id=None)
|
||||
.filter(Tag.device_id.is_(None))
|
||||
.order_by(Tag.created.desc())
|
||||
)
|
||||
|
||||
|
@ -155,9 +170,8 @@ class LotCreateView(View):
|
|||
return flask.redirect(next_url)
|
||||
|
||||
lots = Lot.query.filter(Lot.owner_id == current_user.id)
|
||||
return flask.render_template(
|
||||
self.template_name, form=form, title=self.title, lots=lots
|
||||
)
|
||||
context = {'form': form, 'title': self.title, 'lots': lots}
|
||||
return flask.render_template(self.template_name, **context)
|
||||
|
||||
|
||||
class LotUpdateView(View):
|
||||
|
@ -174,9 +188,8 @@ class LotUpdateView(View):
|
|||
return flask.redirect(next_url)
|
||||
|
||||
lots = Lot.query.filter(Lot.owner_id == current_user.id)
|
||||
return flask.render_template(
|
||||
self.template_name, form=form, title=self.title, lots=lots
|
||||
)
|
||||
context = {'form': form, 'title': self.title, 'lots': lots}
|
||||
return flask.render_template(self.template_name, **context)
|
||||
|
||||
|
||||
class LotDeleteView(View):
|
||||
|
@ -197,15 +210,13 @@ class UploadSnapshotView(View):
|
|||
template_name = 'inventory/upload_snapshot.html'
|
||||
|
||||
def dispatch_request(self):
|
||||
context = {'page_title': 'Upload Snapshot'}
|
||||
lots = Lot.query.filter(Lot.owner_id == current_user.id).all()
|
||||
form = UploadSnapshotForm()
|
||||
context = {'page_title': 'Upload Snapshot', 'lots': lots, 'form': form}
|
||||
if form.validate_on_submit():
|
||||
form.save()
|
||||
|
||||
return flask.render_template(
|
||||
self.template_name, form=form, lots=lots, **context
|
||||
)
|
||||
return flask.render_template(self.template_name, **context)
|
||||
|
||||
|
||||
class DeviceCreateView(View):
|
||||
|
@ -214,17 +225,15 @@ class DeviceCreateView(View):
|
|||
template_name = 'inventory/device_create.html'
|
||||
|
||||
def dispatch_request(self):
|
||||
context = {'page_title': 'New Device'}
|
||||
lots = Lot.query.filter(Lot.owner_id == current_user.id).all()
|
||||
form = NewDeviceForm()
|
||||
context = {'page_title': 'New Device', 'lots': lots, 'form': form}
|
||||
if form.validate_on_submit():
|
||||
form.save()
|
||||
next_url = url_for('inventory.devices.devicelist')
|
||||
return flask.redirect(next_url)
|
||||
|
||||
return flask.render_template(
|
||||
self.template_name, form=form, lots=lots, **context
|
||||
)
|
||||
return flask.render_template(self.template_name, **context)
|
||||
|
||||
|
||||
class TagListView(View):
|
||||
|
@ -233,9 +242,10 @@ class TagListView(View):
|
|||
template_name = 'inventory/tag_list.html'
|
||||
|
||||
def dispatch_request(self):
|
||||
lots = Lot.query.filter(Lot.owner_id == current_user.id)
|
||||
tags = Tag.query.filter(Tag.owner_id == current_user.id)
|
||||
context = {
|
||||
'lots': [],
|
||||
'lots': lots,
|
||||
'tags': tags,
|
||||
'page_title': 'Tags Management',
|
||||
}
|
||||
|
@ -248,7 +258,8 @@ class TagAddView(View):
|
|||
template_name = 'inventory/tag_create.html'
|
||||
|
||||
def dispatch_request(self):
|
||||
context = {'page_title': 'New Tag'}
|
||||
lots = Lot.query.filter(Lot.owner_id == current_user.id)
|
||||
context = {'page_title': 'New Tag', 'lots': lots}
|
||||
form = TagForm()
|
||||
if form.validate_on_submit():
|
||||
form.save()
|
||||
|
@ -264,7 +275,8 @@ class TagAddUnnamedView(View):
|
|||
template_name = 'inventory/tag_create_unnamed.html'
|
||||
|
||||
def dispatch_request(self):
|
||||
context = {'page_title': 'New Unnamed Tag'}
|
||||
lots = Lot.query.filter(Lot.owner_id == current_user.id)
|
||||
context = {'page_title': 'New Unnamed Tag', 'lots': lots}
|
||||
form = TagUnnamedForm()
|
||||
if form.validate_on_submit():
|
||||
form.save()
|
||||
|
@ -311,6 +323,7 @@ class TagUnlinkDeviceView(View):
|
|||
template_name = 'inventory/tag_unlink_device.html'
|
||||
|
||||
def dispatch_request(self, id):
|
||||
lots = Lot.query.filter(Lot.owner_id == current_user.id)
|
||||
form = TagDeviceForm(delete=True, device=id)
|
||||
if form.validate_on_submit():
|
||||
form.remove()
|
||||
|
@ -319,7 +332,7 @@ class TagUnlinkDeviceView(View):
|
|||
return flask.redirect(next_url)
|
||||
|
||||
return flask.render_template(
|
||||
self.template_name, form=form, referrer=request.referrer
|
||||
self.template_name, form=form, lots=lots, referrer=request.referrer
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<header id="header" class="header fixed-top d-flex align-items-center">
|
||||
|
||||
<div class="d-flex align-items-center justify-content-between">
|
||||
<a href="index.html" class="logo d-flex align-items-center">
|
||||
<a href="{{ url_for('inventory.devices.devicelist')}}" class="logo d-flex align-items-center">
|
||||
<img src="{{ url_for('static', filename='img/usody-logo-black.svg') }}" alt="">
|
||||
</a>
|
||||
<i class="bi bi-list toggle-sidebar-btn"></i>
|
||||
|
@ -81,7 +81,7 @@
|
|||
<aside id="sidebar" class="sidebar">
|
||||
|
||||
<ul class="sidebar-nav" id="sidebar-nav">
|
||||
|
||||
<!-- We need defined before the Dashboard
|
||||
<li class="nav-item">
|
||||
<a class="nav-link collapsed" href="index.html">
|
||||
<i class="bi bi-grid"></i>
|
||||
|
@ -99,10 +99,18 @@
|
|||
<li class="nav-heading">Lots</li>
|
||||
|
||||
<li class="nav-item">
|
||||
{% if lot and lot.is_incoming %}
|
||||
<a class="nav-link" data-bs-target="#incoming-lots-nav" data-bs-toggle="collapse" href="#">
|
||||
{% else %}
|
||||
<a class="nav-link collapsed" data-bs-target="#incoming-lots-nav" data-bs-toggle="collapse" href="#">
|
||||
{% endif %}
|
||||
<i class="bi bi-arrow-down-right"></i><span>Incoming Lots</span><i class="bi bi-chevron-down ms-auto"></i>
|
||||
</a>
|
||||
{% if lot and lot.is_incoming %}
|
||||
<ul id="incoming-lots-nav" class="nav-content collapse show" data-bs-parent="#sidebar-nav">
|
||||
{% else %}
|
||||
<ul id="incoming-lots-nav" class="nav-content collapse" data-bs-parent="#sidebar-nav">
|
||||
{% endif %}
|
||||
{% for lot in lots %}
|
||||
{% if lot.is_incoming %}
|
||||
<li>
|
||||
|
@ -116,10 +124,18 @@
|
|||
</li><!-- End Incoming Lots Nav -->
|
||||
|
||||
<li class="nav-item">
|
||||
{% if lot and lot.is_outgoing %}
|
||||
<a class="nav-link" data-bs-target="#outgoing-lots-nav" data-bs-toggle="collapse" href="#">
|
||||
{% else %}
|
||||
<a class="nav-link collapsed" data-bs-target="#outgoing-lots-nav" data-bs-toggle="collapse" href="#">
|
||||
{% endif %}
|
||||
<i class="bi bi-arrow-up-right"></i><span>Outgoing Lots</span><i class="bi bi-chevron-down ms-auto"></i>
|
||||
</a>
|
||||
{% if lot and lot.is_outgoing %}
|
||||
<ul id="outgoing-lots-nav" class="nav-content collapse show" data-bs-parent="#sidebar-nav">
|
||||
{% else %}
|
||||
<ul id="outgoing-lots-nav" class="nav-content collapse " data-bs-parent="#sidebar-nav">
|
||||
{% endif %}
|
||||
{% for lot in lots %}
|
||||
{% if lot.is_outgoing %}
|
||||
<li>
|
||||
|
@ -133,10 +149,18 @@
|
|||
</li><!-- End Outgoing Lots Nav -->
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link collapsed" data-bs-target="#temporal-lots-nav" data-bs-toggle="collapse" href="#">
|
||||
{% if lot and lot.is_temporary %}
|
||||
<a class="nav-link" data-bs-target="#temporal-lots-nav" data-bs-toggle="collapse" href="#">
|
||||
{% else %}
|
||||
<a class="nav-link collapsed" data-bs-target="#temporal-lots-nav" data-bs-toggle="collapse" href="#">
|
||||
{% endif %}
|
||||
<i class="bi bi-layout-text-window-reverse"></i><span>Temporary Lots</span><i class="bi bi-chevron-down ms-auto"></i>
|
||||
</a>
|
||||
{% if lot and lot.is_temporary %}
|
||||
<ul id="temporal-lots-nav" class="nav-content collapse show" data-bs-parent="#sidebar-nav">
|
||||
{% else %}
|
||||
<ul id="temporal-lots-nav" class="nav-content collapse " data-bs-parent="#sidebar-nav">
|
||||
{% endif %}
|
||||
<li>
|
||||
<a href="{{ url_for('inventory.devices.lot_add')}}">
|
||||
<i class="bi bi-plus" style="font-size: larger;"></i><span>New temporary lot</span>
|
||||
|
@ -163,13 +187,6 @@
|
|||
</a>
|
||||
</li><!-- End Tags Page Nav -->
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link collapsed" href="{{ url_for('Document.StampsView') }}">
|
||||
<i class="bi bi-pin-map-fill"></i>
|
||||
<span>Stamp</span>
|
||||
</a>
|
||||
</li><!-- End Stamp Page Nav -->
|
||||
|
||||
</ul>
|
||||
|
||||
</aside><!-- End Sidebar-->
|
||||
|
|
|
@ -28,7 +28,9 @@ class LoginView(View):
|
|||
if not is_safe_url(flask.request, next_url):
|
||||
return flask.abort(400)
|
||||
|
||||
return flask.redirect(next_url or flask.url_for('core.user-profile'))
|
||||
return flask.redirect(
|
||||
next_url or flask.url_for('inventory.devices.devicelist')
|
||||
)
|
||||
return flask.render_template('ereuse_devicehub/user_login.html', form=form)
|
||||
|
||||
|
||||
|
|
Reference in New Issue