fix: Updated Store for Product Categories, Products, and Product Permutations pages for tweaked architecture for controllers, datastores, and python data objects.
This commit is contained in:
Binary file not shown.
@@ -51,8 +51,10 @@ class Base():
|
||||
FLAG_URL: ClassVar[str] = 'url'
|
||||
FLAG_VALUE_LOCAL_VAT_EXCL: ClassVar[str] = 'value_local_vat_excl'
|
||||
FLAG_VALUE_LOCAL_VAT_INCL: ClassVar[str] = 'value_local_vat_incl'
|
||||
"""
|
||||
NAME_ATTR_OPTION_TEXT: ClassVar[str] = 'name-attribute-option-text'
|
||||
NAME_ATTR_OPTION_VALUE: ClassVar[str] = 'name-attribute-option-value'
|
||||
"""
|
||||
|
||||
@classmethod
|
||||
def output_bool(cls, value):
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -16,6 +16,7 @@ from extensions import db
|
||||
import lib.argument_validation as av
|
||||
# external
|
||||
from enum import Enum
|
||||
from typing import ClassVar
|
||||
|
||||
|
||||
class Resolution_Level_Enum(Enum):
|
||||
@@ -48,6 +49,8 @@ class Resolution_Level_Enum(Enum):
|
||||
|
||||
|
||||
class Image(db.Model, Store_Base):
|
||||
NAME_ATTR_OPTION_TEXT: ClassVar[str] = 'url'
|
||||
NAME_ATTR_OPTION_VALUE: ClassVar[str] = 'id_image'
|
||||
id_image = db.Column(db.Integer, primary_key=True)
|
||||
id_product = db.Column(db.Integer)
|
||||
id_permutation = db.Column(db.Integer)
|
||||
|
||||
@@ -490,10 +490,10 @@ class Parameters_Product(Get_Many_Parameters_Base):
|
||||
def from_form_filters_product_permutation(form):
|
||||
# if not (form is Filters_Product_Permutation): raise ValueError(f'Invalid form type: {type(form)}')
|
||||
# av.val_instance(form, 'form', 'Parameters_Product.from_form', Filters_Product_Permutation)
|
||||
has_category_filter = not (form.id_category.data == '0' or form.id_category.data == '')
|
||||
has_product_filter = not (form.id_product.data == '0' or form.id_product.data == '')
|
||||
has_category_filter = not (form.id_category.data == '0' or form.id_category.data == '' or form.id_category.data is None)
|
||||
has_product_filter = not (form.id_product.data == '0' or form.id_product.data == '' or form.id_product.data is None)
|
||||
get_permutations_stock_below_min = av.input_bool(form.is_out_of_stock.data, "is_out_of_stock", "Parameters_Product.from_form")
|
||||
print(f'form question: {type(form.is_out_of_stock)}\nbool interpretted: {get_permutations_stock_below_min}\type form: {type(form)}')
|
||||
print(f'form question: {type(form.is_out_of_stock)}\nbool interpretted: {get_permutations_stock_below_min}\ntype form: {type(form)}')
|
||||
return Parameters_Product(
|
||||
get_all_product_category = not has_category_filter,
|
||||
get_inactive_product_category = False,
|
||||
@@ -595,11 +595,11 @@ class Parameters_Product(Get_Many_Parameters_Base):
|
||||
def from_filters_product_category(cls, filters_category):
|
||||
return cls(
|
||||
get_all_product_category = True,
|
||||
get_inactive_product_category = filters_category.active,
|
||||
get_inactive_product_category = filters_category.active.data,
|
||||
ids_product_category = '',
|
||||
get_all_product = True,
|
||||
get_inactive_product = False,
|
||||
ids_product = False,
|
||||
ids_product = '',
|
||||
get_all_permutation = True,
|
||||
get_inactive_permutation = False,
|
||||
ids_permutation = '',
|
||||
|
||||
@@ -320,6 +320,8 @@ class Filters_Product_Category(Get_Many_Parameters_Base):
|
||||
"""
|
||||
|
||||
class Product_Category_Container(Store_Base):
|
||||
NAME_ATTR_OPTION_TEXT: ClassVar[str] = ''
|
||||
NAME_ATTR_OPTION_VALUE: ClassVar[str] = Store_Base.FLAG_ROWS
|
||||
categories: list
|
||||
def __init__(self):
|
||||
self.categories = []
|
||||
|
||||
Reference in New Issue
Block a user