add solar panel to the interface
This commit is contained in:
parent
d5e93f3a52
commit
3408af33a8
|
@ -68,6 +68,7 @@ from ereuse_devicehub.resources.device.models import (
|
||||||
Projector,
|
Projector,
|
||||||
Server,
|
Server,
|
||||||
Smartphone,
|
Smartphone,
|
||||||
|
SolarPanel,
|
||||||
SolidStateDrive,
|
SolidStateDrive,
|
||||||
Tablet,
|
Tablet,
|
||||||
TelevisionSet,
|
TelevisionSet,
|
||||||
|
@ -113,7 +114,7 @@ DEVICES = {
|
||||||
"SAI",
|
"SAI",
|
||||||
"Keyboard",
|
"Keyboard",
|
||||||
],
|
],
|
||||||
"Other Devices": ["Other"],
|
"Other Devices": ["SolarPanel", "Other"],
|
||||||
}
|
}
|
||||||
|
|
||||||
TYPES_DOCUMENTS = [
|
TYPES_DOCUMENTS = [
|
||||||
|
@ -131,7 +132,7 @@ MONITORS = ["ComputerMonitor", "Monitor", "TelevisionSet", "Projector"]
|
||||||
MOBILE = ["Mobile", "Tablet", "Smartphone", "Cellphone"]
|
MOBILE = ["Mobile", "Tablet", "Smartphone", "Cellphone"]
|
||||||
STORAGE = ["HardDrive", "SolidStateDrive"]
|
STORAGE = ["HardDrive", "SolidStateDrive"]
|
||||||
ACCESSORIES = ["Mouse", "MemoryCardReader", "SAI", "Keyboard"]
|
ACCESSORIES = ["Mouse", "MemoryCardReader", "SAI", "Keyboard"]
|
||||||
OTHERS = ["Other"]
|
OTHERS = ["Other", "SolarPanel"]
|
||||||
DATASTORAGE = ['HardDrive', 'SolidStateDrive']
|
DATASTORAGE = ['HardDrive', 'SolidStateDrive']
|
||||||
|
|
||||||
|
|
||||||
|
@ -433,6 +434,7 @@ class NewDeviceForm(FlaskForm):
|
||||||
"Keyboard": Keyboard,
|
"Keyboard": Keyboard,
|
||||||
"SAI": SAI,
|
"SAI": SAI,
|
||||||
"MemoryCardReader": MemoryCardReader,
|
"MemoryCardReader": MemoryCardReader,
|
||||||
|
"SolarPanel": SolarPanel,
|
||||||
"Other": Other,
|
"Other": Other,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1227,7 +1229,6 @@ class TradeForm(ActionFormMixin):
|
||||||
or email_to == email_from
|
or email_to == email_from
|
||||||
or g.user.email not in [email_from, email_to]
|
or g.user.email not in [email_from, email_to]
|
||||||
):
|
):
|
||||||
|
|
||||||
errors = ["If you want confirm, you need a correct email"]
|
errors = ["If you want confirm, you need a correct email"]
|
||||||
self.user_to.errors = errors
|
self.user_to.errors = errors
|
||||||
self.user_from.errors = errors
|
self.user_from.errors = errors
|
||||||
|
@ -1933,7 +1934,6 @@ class UploadPlaceholderForm(FlaskForm):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def save(self, commit=True):
|
def save(self, commit=True):
|
||||||
|
|
||||||
for device, placeholder_log in self.placeholders:
|
for device, placeholder_log in self.placeholders:
|
||||||
db.session.add(device)
|
db.session.add(device)
|
||||||
db.session.add(placeholder_log)
|
db.session.add(placeholder_log)
|
||||||
|
@ -1962,7 +1962,6 @@ class EditPlaceholderForm(FlaskForm):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def save(self, commit=True):
|
def save(self, commit=True):
|
||||||
|
|
||||||
for device in self.placeholders:
|
for device in self.placeholders:
|
||||||
db.session.add(device)
|
db.session.add(device)
|
||||||
|
|
||||||
|
|
|
@ -726,3 +726,34 @@ class OtherDef(DeviceDef):
|
||||||
root_path,
|
root_path,
|
||||||
cli_commands,
|
cli_commands,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class SolarPanelDef(DeviceDef):
|
||||||
|
VIEW = None
|
||||||
|
SCHEMA = schemas.SolarPanel
|
||||||
|
|
||||||
|
def __init__(
|
||||||
|
self,
|
||||||
|
app,
|
||||||
|
import_name=__name__,
|
||||||
|
static_folder=None,
|
||||||
|
static_url_path=None,
|
||||||
|
template_folder=None,
|
||||||
|
url_prefix=None,
|
||||||
|
subdomain=None,
|
||||||
|
url_defaults=None,
|
||||||
|
root_path=None,
|
||||||
|
cli_commands: Iterable[Tuple[Callable, str or None]] = tuple(),
|
||||||
|
):
|
||||||
|
super().__init__(
|
||||||
|
app,
|
||||||
|
import_name,
|
||||||
|
static_folder,
|
||||||
|
static_url_path,
|
||||||
|
template_folder,
|
||||||
|
url_prefix,
|
||||||
|
subdomain,
|
||||||
|
url_defaults,
|
||||||
|
root_path,
|
||||||
|
cli_commands,
|
||||||
|
)
|
||||||
|
|
|
@ -590,5 +590,9 @@ class Racket(Recreation):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class SolarPanel(Device):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Other(Device):
|
class Other(Device):
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -79,6 +79,8 @@
|
||||||
{% if form.type.data == 'Keyboard' %} selected="selected"{% endif %}>Keyboard</option>
|
{% if form.type.data == 'Keyboard' %} selected="selected"{% endif %}>Keyboard</option>
|
||||||
</optgroup>
|
</optgroup>
|
||||||
<optgroup label="Other Type of Device">
|
<optgroup label="Other Type of Device">
|
||||||
|
<option value="SolarPanel"
|
||||||
|
{% if form.type.data == 'SolarPanel' %} selected="selected"{% endif %}>Solar Panel</option>
|
||||||
<option value="Other"
|
<option value="Other"
|
||||||
{% if form.type.data == 'Other' %} selected="selected"{% endif %}>Other</option>
|
{% if form.type.data == 'Other' %} selected="selected"{% endif %}>Other</option>
|
||||||
</optgroup>
|
</optgroup>
|
||||||
|
|
|
@ -72,6 +72,12 @@
|
||||||
<option value="Keyboard"
|
<option value="Keyboard"
|
||||||
{% if form.type.data == 'Keyboard' %} selected="selected"{% endif %}>Keyboard</option>
|
{% if form.type.data == 'Keyboard' %} selected="selected"{% endif %}>Keyboard</option>
|
||||||
</optgroup>
|
</optgroup>
|
||||||
|
<optgroup label="Other Type of Device">
|
||||||
|
<option value="SolarPanel"
|
||||||
|
{% if form.type.data == 'SolarPanel' %} selected="selected"{% endif %}>Solar Panel</option>
|
||||||
|
<option value="Other"
|
||||||
|
{% if form.type.data == 'Other' %} selected="selected"{% endif %}>Other</option>
|
||||||
|
</optgroup>
|
||||||
</select>
|
</select>
|
||||||
<small class="text-muted form-text">Type of devices</small>
|
<small class="text-muted form-text">Type of devices</small>
|
||||||
{% if form.type.errors %}
|
{% if form.type.errors %}
|
||||||
|
|
Reference in New Issue