Skip to content

Commit

Permalink
Merge pull request #531 from Abdur-rahmaanJ/feat/replace-marshmallow
Browse files Browse the repository at this point in the history
Feat/replace marshmallow
  • Loading branch information
Abdur-rahmaanJ authored Sep 26, 2024
2 parents bdf14de + 98ffd9c commit d8030ff
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
Binary file modified reqs/app.in
Binary file not shown.
12 changes: 7 additions & 5 deletions reqs/app.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ flask-login==0.6.2
# shopyo
flask-mailman==0.3.0
# via shopyo
flask-marshmallow==0.14.0
flask-marshmallow==1.0.0
# via shopyo
flask-migrate==3.1.0
# via shopyo
Expand Down Expand Up @@ -71,7 +71,9 @@ marshmallow==3.14.1
# marshmallow-sqlalchemy
# shopyo
marshmallow-sqlalchemy==0.26.1
# via shopyo
# via
# -r reqs/app.in
# shopyo
mkdocs-material-extensions==1.0.3
# via flask-mailman
numpy==2.1.1
Expand All @@ -80,6 +82,8 @@ numpy==2.1.1
# pandas
openpyxl==3.0.10
# via -r reqs/app.in
packaging==24.1
# via flask-marshmallow
pandas==2.2.2
# via -r reqs/app.in
pillow==10.4.0
Expand All @@ -95,9 +99,7 @@ pytz==2022.2.1
shopyo==4.8.6
# via pythoncms
six==1.16.0
# via
# flask-marshmallow
# python-dateutil
# via python-dateutil
sqlalchemy==1.4.46
# via
# alembic
Expand Down
6 changes: 1 addition & 5 deletions src/shopcube/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from flask_login import LoginManager
from flask_mailman import Mail
#from flask_marshmallow import Marshmallow
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from flask_uploads import DOCUMENTS
Expand All @@ -21,9 +20,7 @@
installed_packages = []

db = SQLAlchemy()
# ma = Marshmallow()

ma = None

login_manager = LoginManager()
migrate = Migrate()
mail = Mail()
Expand All @@ -46,7 +43,6 @@ def configure_all_uploads(app):
def load_extensions(app):
migrate.init_app(app, db)
db.init_app(app)
# ma.init_app(app)
mail.init_app(app)
login_manager.init_app(app)
csrf.init_app(app)
32 changes: 17 additions & 15 deletions src/shopcube/modules/box__ecommerce/product/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from werkzeug.utils import secure_filename

from init import db
from init import ma
from init import productphotos

from modules.box__ecommerce.category.models import SubCategory
Expand All @@ -28,6 +27,9 @@
from modules.box__ecommerce.product.models import Size
from modules.resource.models import Resource

from marshmallow_sqlalchemy import SQLAlchemySchema, auto_field


dirpath = os.path.dirname(os.path.abspath(__file__))
module_info = {}

Expand All @@ -42,23 +44,23 @@
url_prefix=module_info["url_prefix"],
)


class Productchema(ma.Schema):
class ProductSchema(SQLAlchemySchema):
class Meta:
# Fields to expose
fields = (
"barcode",
"name",
"description",
"price",
"selling_price",
"in_stock",
"discontinued",
)
model = Product
load_instance = True # Optional: deserialize to model instances

barcode = auto_field()
name = auto_field()
description = auto_field()
price = auto_field()
selling_price = auto_field()
in_stock = auto_field()
discontinued = auto_field()



product_schema = Productchema()
product_schema = Productchema(many=True)
product_schema = ProductSchema()
product_schema = ProductSchema(many=True)

module_blueprint = globals()["{}_blueprint".format(module_info["module_name"])]

Expand Down

0 comments on commit d8030ff

Please sign in to comment.