diff --git a/ereuse_devicehub/inventory/forms.py b/ereuse_devicehub/inventory/forms.py
index 3801a07d..9cc85d30 100644
--- a/ereuse_devicehub/inventory/forms.py
+++ b/ereuse_devicehub/inventory/forms.py
@@ -52,6 +52,7 @@ from ereuse_devicehub.resources.device.models import (
MemoryCardReader,
Monitor,
Mouse,
+ Other,
Placeholder,
Projector,
Server,
@@ -84,7 +85,6 @@ DEVICES = {
],
"Mobile, tablet & smartphone": [
"All Mobile",
- "Mobile",
"Tablet",
"Smartphone",
"Cellphone",
@@ -101,6 +101,7 @@ DEVICES = {
"SAI",
"Keyboard",
],
+ "Other Devices": ["Other"],
}
COMPUTERS = ['Desktop', 'Laptop', 'Server', 'Computer']
@@ -109,6 +110,7 @@ MONITORS = ["ComputerMonitor", "Monitor", "TelevisionSet", "Projector"]
MOBILE = ["Mobile", "Tablet", "Smartphone", "Cellphone"]
STORAGE = ["HardDrive", "SolidStateDrive"]
ACCESSORIES = ["Mouse", "MemoryCardReader", "SAI", "Keyboard"]
+OTHERS = ["Other"]
class AdvancedSearchForm(FlaskForm):
@@ -181,7 +183,7 @@ class FilterForm(FlaskForm):
# Generic Filters
if "All Devices" == self.device_type:
- filter_type = COMPUTERS + MONITORS + MOBILE
+ filter_type = COMPUTERS + MONITORS + MOBILE + OTHERS
elif "All Computers" == self.device_type:
filter_type = COMPUTERS
@@ -392,6 +394,7 @@ class NewDeviceForm(FlaskForm):
"Keyboard": Keyboard,
"SAI": SAI,
"MemoryCardReader": MemoryCardReader,
+ "Other": Other,
}
def reset_from_obj(self):
diff --git a/ereuse_devicehub/migrations/versions/410aadae7652_device_other.py b/ereuse_devicehub/migrations/versions/410aadae7652_device_other.py
new file mode 100644
index 00000000..1d22d1dd
--- /dev/null
+++ b/ereuse_devicehub/migrations/versions/410aadae7652_device_other.py
@@ -0,0 +1,39 @@
+"""device other
+
+Revision ID: 410aadae7652
+Revises: d65745749e34
+Create Date: 2022-11-29 12:00:40.272121
+
+"""
+import sqlalchemy as sa
+from alembic import context, op
+
+# revision identifiers, used by Alembic.
+revision = '410aadae7652'
+down_revision = 'd65745749e34'
+branch_labels = None
+depends_on = None
+
+
+def get_inv():
+ INV = context.get_x_argument(as_dictionary=True).get('inventory')
+ if not INV:
+ raise ValueError("Inventory value is not specified")
+ return INV
+
+
+def upgrade():
+ op.create_table(
+ 'other',
+ sa.Column('id', sa.BigInteger(), nullable=False),
+ sa.ForeignKeyConstraint(
+ ['id'],
+ [f'{get_inv()}.device.id'],
+ ),
+ sa.PrimaryKeyConstraint('id'),
+ schema=f'{get_inv()}',
+ )
+
+
+def downgrade():
+ op.drop_table('other', schema=f'{get_inv()}')
diff --git a/ereuse_devicehub/resources/device/definitions.py b/ereuse_devicehub/resources/device/definitions.py
index 015d5040..86f74204 100644
--- a/ereuse_devicehub/resources/device/definitions.py
+++ b/ereuse_devicehub/resources/device/definitions.py
@@ -695,3 +695,8 @@ class ManufacturerDef(Resource):
"""Loads the manufacturers to the database."""
if exclude_schema != 'common':
Manufacturer.add_all_to_session(db.session)
+
+
+class OtherDef(DeviceDef):
+ VIEW = None
+ SCHEMA = schemas.Other
diff --git a/ereuse_devicehub/resources/device/models.py b/ereuse_devicehub/resources/device/models.py
index 35e4d559..6fa60182 100644
--- a/ereuse_devicehub/resources/device/models.py
+++ b/ereuse_devicehub/resources/device/models.py
@@ -1637,3 +1637,11 @@ def create_code_tag(mapper, connection, device):
# from flask_sqlalchemy import event
# event.listen(Device, 'after_insert', create_code_tag, propagate=True)
+
+
+class Other(Device):
+ """
+ Used for put in there all devices than not have actualy a class
+ """
+
+ id = Column(BigInteger, ForeignKey(Device.id), primary_key=True)
diff --git a/ereuse_devicehub/resources/device/schemas.py b/ereuse_devicehub/resources/device/schemas.py
index b689a968..8f92ffa7 100644
--- a/ereuse_devicehub/resources/device/schemas.py
+++ b/ereuse_devicehub/resources/device/schemas.py
@@ -581,3 +581,7 @@ class Bike(Recreation):
class Racket(Recreation):
pass
+
+
+class Other(Device):
+ pass
diff --git a/ereuse_devicehub/templates/inventory/device_create.html b/ereuse_devicehub/templates/inventory/device_create.html
index 603aee38..8ad8634a 100644
--- a/ereuse_devicehub/templates/inventory/device_create.html
+++ b/ereuse_devicehub/templates/inventory/device_create.html
@@ -72,6 +72,10 @@
+
Type of devices
{% if form.type.errors %}