Add inventory management templates and utility functions
- Created HTML templates for inventory index, layout, search, settings, table, user, and worklog. - Implemented utility functions for eager loading relationships in SQLAlchemy. - Added validation mixin for form submissions. - Updated project configuration files (pyproject.toml and setup.cfg) for package management.
This commit is contained in:
parent
602bb77e22
commit
9803db17ab
51 changed files with 76 additions and 16 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -5,3 +5,5 @@
|
|||
*.db-journal
|
||||
*.sqlite
|
||||
*.sqlite3
|
||||
alembic.ini
|
||||
alembic/
|
12
inventory.egg-info/PKG-INFO
Normal file
12
inventory.egg-info/PKG-INFO
Normal file
|
@ -0,0 +1,12 @@
|
|||
Metadata-Version: 2.4
|
||||
Name: inventory
|
||||
Version: 0.1.0
|
||||
Summary: A Flask app for tracking inventory.
|
||||
Requires-Python: >=3.9
|
||||
Requires-Dist: python-dotenv
|
||||
Requires-Dist: flask
|
||||
Requires-Dist: flask_sqlalchemy
|
||||
Requires-Dist: pandas
|
||||
Requires-Dist: pyodbc
|
||||
Requires-Dist: beautifulsoup4
|
||||
Requires-Dist: alembic
|
1
inventory.egg-info/dependency_links.txt
Normal file
1
inventory.egg-info/dependency_links.txt
Normal file
|
@ -0,0 +1 @@
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
dotenv
|
||||
python-dotenv
|
||||
flask
|
||||
flask_sqlalchemy
|
||||
pandas
|
||||
pyodbc
|
||||
beautifulsoup4
|
||||
beautifulsoup4
|
||||
alembic
|
1
inventory.egg-info/top_level.txt
Normal file
1
inventory.egg-info/top_level.txt
Normal file
|
@ -0,0 +1 @@
|
|||
inventory
|
|
@ -24,7 +24,7 @@ def create_app():
|
|||
|
||||
with app.app_context():
|
||||
from . import models
|
||||
db.create_all()
|
||||
# db.create_all()
|
||||
|
||||
from .routes import main
|
||||
app.register_blueprint(main)
|
24
inventory/models/__init__.py
Normal file
24
inventory/models/__init__.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
from inventory import db # Yes, this works when run from project root with Alembic
|
||||
|
||||
from .areas import Area
|
||||
from .brands import Brand
|
||||
from .items import Item
|
||||
from .inventory import Inventory
|
||||
from .room_functions import RoomFunction
|
||||
from .users import User
|
||||
from .work_log import WorkLog
|
||||
from .rooms import Room
|
||||
|
||||
__all__ = [
|
||||
"db",
|
||||
"Area",
|
||||
"Brand",
|
||||
"Item",
|
||||
"Inventory",
|
||||
"RoomFunction",
|
||||
"User",
|
||||
"WorkLog",
|
||||
"Room",
|
||||
]
|
|
@ -14,11 +14,11 @@ class Brand(ValidatableMixin, db.Model):
|
|||
VALIDATION_LABEL = 'Brand'
|
||||
|
||||
id: Mapped[int] = mapped_column("ID", Integer, Identity(start=1, increment=1), primary_key=True)
|
||||
name: Mapped[Optional[str]] = mapped_column("Brand", Unicode(255), nullable=True)
|
||||
name: Mapped[str] = mapped_column("Brand", Unicode(255), nullable=False)
|
||||
|
||||
inventory: Mapped[List['Inventory']] = relationship('Inventory', back_populates='brand')
|
||||
|
||||
def __init__(self, name: Optional[str] = None):
|
||||
def __init__(self, name: str):
|
||||
self.name = name
|
||||
|
||||
def __repr__(self):
|
0
inventory/utils/__init__.py
Normal file
0
inventory/utils/__init__.py
Normal file
|
@ -1,11 +0,0 @@
|
|||
from typing import TYPE_CHECKING
|
||||
|
||||
from .. import db # If you're in an actual module
|
||||
from .areas import Area
|
||||
from .brands import Brand
|
||||
from .items import Item
|
||||
from .inventory import Inventory
|
||||
from .room_functions import RoomFunction
|
||||
from .users import User
|
||||
from .work_log import WorkLog
|
||||
from .rooms import Room
|
21
pyproject.toml
Normal file
21
pyproject.toml
Normal file
|
@ -0,0 +1,21 @@
|
|||
[project]
|
||||
name = "inventory"
|
||||
version = "0.1.0"
|
||||
description = "A Flask app for tracking inventory."
|
||||
requires-python = ">=3.9"
|
||||
dependencies = [
|
||||
"python-dotenv",
|
||||
"flask",
|
||||
"flask_sqlalchemy",
|
||||
"pandas",
|
||||
"pyodbc",
|
||||
"beautifulsoup4",
|
||||
"alembic"
|
||||
]
|
||||
|
||||
[build-system]
|
||||
requires = ["setuptools"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.setuptools]
|
||||
packages = ["inventory"]
|
9
setup.cfg
Normal file
9
setup.cfg
Normal file
|
@ -0,0 +1,9 @@
|
|||
[metadata]
|
||||
name = inventory
|
||||
version = 0.1.0
|
||||
|
||||
[options]
|
||||
packages = find:
|
||||
|
||||
[options.packages.find]
|
||||
where = .
|
Loading…
Add table
Add a link
Reference in a new issue