Add of DeviceHub in template
This commit is contained in:
parent
57e9a7ef9a
commit
b4b12da477
|
@ -1 +1 @@
|
||||||
__version__ = "1.0.12-beta"
|
__version__ = "2.0.0-alpha"
|
||||||
|
|
|
@ -11,7 +11,7 @@ from requests.exceptions import ConnectionError
|
||||||
from sqlalchemy import or_
|
from sqlalchemy import or_
|
||||||
from werkzeug.exceptions import NotFound
|
from werkzeug.exceptions import NotFound
|
||||||
|
|
||||||
from ereuse_devicehub import messages
|
from ereuse_devicehub import __version__, messages
|
||||||
from ereuse_devicehub.db import db
|
from ereuse_devicehub.db import db
|
||||||
from ereuse_devicehub.inventory.forms import (
|
from ereuse_devicehub.inventory.forms import (
|
||||||
AllocateForm,
|
AllocateForm,
|
||||||
|
@ -122,6 +122,7 @@ class DeviceListMix(GenericMixView):
|
||||||
'lot': lot,
|
'lot': lot,
|
||||||
'tags': tags,
|
'tags': tags,
|
||||||
'list_devices': list_devices,
|
'list_devices': list_devices,
|
||||||
|
'version': __version__,
|
||||||
}
|
}
|
||||||
|
|
||||||
return self.context
|
return self.context
|
||||||
|
@ -149,6 +150,7 @@ class DeviceDetailView(GenericMixView):
|
||||||
'device': device,
|
'device': device,
|
||||||
'lots': lots,
|
'lots': lots,
|
||||||
'page_title': 'Device {}'.format(device.devicehub_id),
|
'page_title': 'Device {}'.format(device.devicehub_id),
|
||||||
|
'version': __version__,
|
||||||
}
|
}
|
||||||
return flask.render_template(self.template_name, **context)
|
return flask.render_template(self.template_name, **context)
|
||||||
|
|
||||||
|
@ -207,7 +209,12 @@ class LotCreateView(GenericMixView):
|
||||||
return flask.redirect(next_url)
|
return flask.redirect(next_url)
|
||||||
|
|
||||||
lots = self.get_lots()
|
lots = self.get_lots()
|
||||||
context = {'form': form, 'title': self.title, 'lots': lots}
|
context = {
|
||||||
|
'form': form,
|
||||||
|
'title': self.title,
|
||||||
|
'lots': lots,
|
||||||
|
'version': __version__,
|
||||||
|
}
|
||||||
return flask.render_template(self.template_name, **context)
|
return flask.render_template(self.template_name, **context)
|
||||||
|
|
||||||
|
|
||||||
|
@ -225,7 +232,12 @@ class LotUpdateView(View):
|
||||||
return flask.redirect(next_url)
|
return flask.redirect(next_url)
|
||||||
|
|
||||||
lots = Lot.query.filter(Lot.owner_id == current_user.id)
|
lots = Lot.query.filter(Lot.owner_id == current_user.id)
|
||||||
context = {'form': form, 'title': self.title, 'lots': lots}
|
context = {
|
||||||
|
'form': form,
|
||||||
|
'title': self.title,
|
||||||
|
'lots': lots,
|
||||||
|
'version': __version__,
|
||||||
|
}
|
||||||
return flask.render_template(self.template_name, **context)
|
return flask.render_template(self.template_name, **context)
|
||||||
|
|
||||||
|
|
||||||
|
@ -260,6 +272,7 @@ class UploadSnapshotView(GenericMixView):
|
||||||
'lots': lots,
|
'lots': lots,
|
||||||
'form': form,
|
'form': form,
|
||||||
'lot_id': lot_id,
|
'lot_id': lot_id,
|
||||||
|
'version': __version__,
|
||||||
}
|
}
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
snapshot = form.save(commit=False)
|
snapshot = form.save(commit=False)
|
||||||
|
@ -285,6 +298,7 @@ class DeviceCreateView(GenericMixView):
|
||||||
'lots': lots,
|
'lots': lots,
|
||||||
'form': form,
|
'form': form,
|
||||||
'lot_id': lot_id,
|
'lot_id': lot_id,
|
||||||
|
'version': __version__,
|
||||||
}
|
}
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
snapshot = form.save(commit=False)
|
snapshot = form.save(commit=False)
|
||||||
|
@ -314,6 +328,7 @@ class TagListView(View):
|
||||||
'lots': lots,
|
'lots': lots,
|
||||||
'tags': tags,
|
'tags': tags,
|
||||||
'page_title': 'Tags Management',
|
'page_title': 'Tags Management',
|
||||||
|
'version': __version__,
|
||||||
}
|
}
|
||||||
return flask.render_template(self.template_name, **context)
|
return flask.render_template(self.template_name, **context)
|
||||||
|
|
||||||
|
@ -325,7 +340,7 @@ class TagAddView(View):
|
||||||
|
|
||||||
def dispatch_request(self):
|
def dispatch_request(self):
|
||||||
lots = Lot.query.filter(Lot.owner_id == current_user.id)
|
lots = Lot.query.filter(Lot.owner_id == current_user.id)
|
||||||
context = {'page_title': 'New Tag', 'lots': lots}
|
context = {'page_title': 'New Tag', 'lots': lots, 'version': __version__}
|
||||||
form = TagForm()
|
form = TagForm()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
form.save()
|
form.save()
|
||||||
|
@ -342,7 +357,11 @@ class TagAddUnnamedView(View):
|
||||||
|
|
||||||
def dispatch_request(self):
|
def dispatch_request(self):
|
||||||
lots = Lot.query.filter(Lot.owner_id == current_user.id)
|
lots = Lot.query.filter(Lot.owner_id == current_user.id)
|
||||||
context = {'page_title': 'New Unnamed Tag', 'lots': lots}
|
context = {
|
||||||
|
'page_title': 'New Unnamed Tag',
|
||||||
|
'lots': lots,
|
||||||
|
'version': __version__,
|
||||||
|
}
|
||||||
form = TagUnnamedForm()
|
form = TagUnnamedForm()
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
try:
|
try:
|
||||||
|
@ -377,6 +396,7 @@ class TagDetailView(View):
|
||||||
'lots': lots,
|
'lots': lots,
|
||||||
'tag': tag,
|
'tag': tag,
|
||||||
'page_title': '{} Tag'.format(tag.code),
|
'page_title': '{} Tag'.format(tag.code),
|
||||||
|
'version': __version__,
|
||||||
}
|
}
|
||||||
return flask.render_template(self.template_name, **context)
|
return flask.render_template(self.template_name, **context)
|
||||||
|
|
||||||
|
@ -409,7 +429,11 @@ class TagUnlinkDeviceView(View):
|
||||||
return flask.redirect(next_url)
|
return flask.redirect(next_url)
|
||||||
|
|
||||||
return flask.render_template(
|
return flask.render_template(
|
||||||
self.template_name, form=form, lots=lots, referrer=request.referrer
|
self.template_name,
|
||||||
|
form=form,
|
||||||
|
lots=lots,
|
||||||
|
referrer=request.referrer,
|
||||||
|
version=__version__,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -522,7 +546,7 @@ class NewTradeDocumentView(View):
|
||||||
return flask.redirect(next_url)
|
return flask.redirect(next_url)
|
||||||
|
|
||||||
return flask.render_template(
|
return flask.render_template(
|
||||||
self.template_name, form=self.form, title=self.title
|
self.template_name, form=self.form, title=self.title, version=__version__
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -216,7 +216,7 @@
|
||||||
<!-- You can delete the links only if you purchased the pro version. -->
|
<!-- You can delete the links only if you purchased the pro version. -->
|
||||||
<!-- Licensing information: https://bootstrapmade.com/license/ -->
|
<!-- Licensing information: https://bootstrapmade.com/license/ -->
|
||||||
<!-- Purchase the pro version with working PHP/AJAX contact form: https://bootstrapmade.com/nice-admin-bootstrap-admin-html-template/ -->
|
<!-- Purchase the pro version with working PHP/AJAX contact form: https://bootstrapmade.com/nice-admin-bootstrap-admin-html-template/ -->
|
||||||
Designed by <a href="https://bootstrapmade.com/">BootstrapMade</a> // DeviceHub v2.0.0a2
|
Designed by <a href="https://bootstrapmade.com/">BootstrapMade</a> // DeviceHub {{ version }}
|
||||||
</div>
|
</div>
|
||||||
</footer><!-- End Footer -->
|
</footer><!-- End Footer -->
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ from flask import Blueprint
|
||||||
from flask.views import View
|
from flask.views import View
|
||||||
from flask_login import current_user, login_required, login_user, logout_user
|
from flask_login import current_user, login_required, login_user, logout_user
|
||||||
|
|
||||||
|
from ereuse_devicehub import __version__
|
||||||
from ereuse_devicehub.forms import LoginForm
|
from ereuse_devicehub.forms import LoginForm
|
||||||
from ereuse_devicehub.resources.user.models import User
|
from ereuse_devicehub.resources.user.models import User
|
||||||
from ereuse_devicehub.utils import is_safe_url
|
from ereuse_devicehub.utils import is_safe_url
|
||||||
|
@ -31,7 +32,8 @@ class LoginView(View):
|
||||||
return flask.redirect(
|
return flask.redirect(
|
||||||
next_url or flask.url_for('inventory.devices.devicelist')
|
next_url or flask.url_for('inventory.devices.devicelist')
|
||||||
)
|
)
|
||||||
return flask.render_template('ereuse_devicehub/user_login.html', form=form)
|
context = {'form': form, 'version': __version__}
|
||||||
|
return flask.render_template('ereuse_devicehub/user_login.html', **context)
|
||||||
|
|
||||||
|
|
||||||
class LogoutView(View):
|
class LogoutView(View):
|
||||||
|
@ -47,6 +49,7 @@ class UserProfileView(View):
|
||||||
def dispatch_request(self):
|
def dispatch_request(self):
|
||||||
context = {
|
context = {
|
||||||
'current_user': current_user,
|
'current_user': current_user,
|
||||||
|
'version': __version__,
|
||||||
}
|
}
|
||||||
return flask.render_template(self.template_name, **context)
|
return flask.render_template(self.template_name, **context)
|
||||||
|
|
||||||
|
|
Reference in New Issue