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,
|
||||
Server,
|
||||
Smartphone,
|
||||
SolarPanel,
|
||||
SolidStateDrive,
|
||||
Tablet,
|
||||
TelevisionSet,
|
||||
|
@ -113,7 +114,7 @@ DEVICES = {
|
|||
"SAI",
|
||||
"Keyboard",
|
||||
],
|
||||
"Other Devices": ["Other"],
|
||||
"Other Devices": ["SolarPanel", "Other"],
|
||||
}
|
||||
|
||||
TYPES_DOCUMENTS = [
|
||||
|
@ -131,7 +132,7 @@ MONITORS = ["ComputerMonitor", "Monitor", "TelevisionSet", "Projector"]
|
|||
MOBILE = ["Mobile", "Tablet", "Smartphone", "Cellphone"]
|
||||
STORAGE = ["HardDrive", "SolidStateDrive"]
|
||||
ACCESSORIES = ["Mouse", "MemoryCardReader", "SAI", "Keyboard"]
|
||||
OTHERS = ["Other"]
|
||||
OTHERS = ["Other", "SolarPanel"]
|
||||
DATASTORAGE = ['HardDrive', 'SolidStateDrive']
|
||||
|
||||
|
||||
|
@ -433,6 +434,7 @@ class NewDeviceForm(FlaskForm):
|
|||
"Keyboard": Keyboard,
|
||||
"SAI": SAI,
|
||||
"MemoryCardReader": MemoryCardReader,
|
||||
"SolarPanel": SolarPanel,
|
||||
"Other": Other,
|
||||
}
|
||||
|
||||
|
@ -1227,7 +1229,6 @@ class TradeForm(ActionFormMixin):
|
|||
or email_to == email_from
|
||||
or g.user.email not in [email_from, email_to]
|
||||
):
|
||||
|
||||
errors = ["If you want confirm, you need a correct email"]
|
||||
self.user_to.errors = errors
|
||||
self.user_from.errors = errors
|
||||
|
@ -1933,7 +1934,6 @@ class UploadPlaceholderForm(FlaskForm):
|
|||
return True
|
||||
|
||||
def save(self, commit=True):
|
||||
|
||||
for device, placeholder_log in self.placeholders:
|
||||
db.session.add(device)
|
||||
db.session.add(placeholder_log)
|
||||
|
@ -1962,7 +1962,6 @@ class EditPlaceholderForm(FlaskForm):
|
|||
return True
|
||||
|
||||
def save(self, commit=True):
|
||||
|
||||
for device in self.placeholders:
|
||||
db.session.add(device)
|
||||
|
||||
|
|
|
@ -726,3 +726,34 @@ class OtherDef(DeviceDef):
|
|||
root_path,
|
||||
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
|
||||
|
||||
|
||||
class SolarPanel(Device):
|
||||
pass
|
||||
|
||||
|
||||
class Other(Device):
|
||||
pass
|
||||
|
|
|
@ -79,6 +79,8 @@
|
|||
{% if form.type.data == 'Keyboard' %} selected="selected"{% endif %}>Keyboard</option>
|
||||
</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>
|
||||
|
|
|
@ -72,6 +72,12 @@
|
|||
<option value="Keyboard"
|
||||
{% if form.type.data == 'Keyboard' %} selected="selected"{% endif %}>Keyboard</option>
|
||||
</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>
|
||||
<small class="text-muted form-text">Type of devices</small>
|
||||
{% if form.type.errors %}
|
||||
|
|
Reference in New Issue