remove: Temporarily remove "compareto" feature
- Input validation is tricky for this feature. - This is postponed until a future release.
This commit is contained in:
parent
0b571c1c07
commit
9a4650626f
@ -19,8 +19,7 @@ class Attribute:
|
|||||||
unique: bool = False
|
unique: bool = False
|
||||||
primary: bool = False
|
primary: bool = False
|
||||||
default_val: Optional[str] = None
|
default_val: Optional[str] = None
|
||||||
compareto: Optional[List[Tuple[str, str]]] = None
|
compareto: Optional[List[Tuple[str, str]]] = None # Work in progress
|
||||||
#valid_comparisons: Optional[Set[str]] = None
|
|
||||||
|
|
||||||
def validate(self) -> Optional[str]:
|
def validate(self) -> Optional[str]:
|
||||||
"""Validate common attributes. Returns an error message if invalid, otherwise None."""
|
"""Validate common attributes. Returns an error message if invalid, otherwise None."""
|
||||||
|
@ -10,7 +10,7 @@ db = SQLAlchemy()
|
|||||||
# Users table
|
# Users table
|
||||||
class User(db.Model):
|
class User(db.Model):
|
||||||
"""User model for authentication."""
|
"""User model for authentication."""
|
||||||
__tablename__ = "users_test"
|
__tablename__ = "users"
|
||||||
|
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
username = db.Column(db.String(50), unique=True, nullable=False)
|
username = db.Column(db.String(50), unique=True, nullable=False)
|
||||||
|
@ -27,6 +27,8 @@ def validate_config(item_attributes: List[Attribute]) -> str:
|
|||||||
|
|
||||||
# Validate comparison (if applicable)
|
# Validate comparison (if applicable)
|
||||||
if attrib.compareto:
|
if attrib.compareto:
|
||||||
|
return f"'{attrib.attrib_name}': 'compareto' feature is not fully implemented in this release."
|
||||||
|
''' WIP
|
||||||
if not isinstance(attrib.compareto, list) or not all(
|
if not isinstance(attrib.compareto, list) or not all(
|
||||||
isinstance(pair, tuple) and len(pair) == 2 for pair in attrib.compareto
|
isinstance(pair, tuple) and len(pair) == 2 for pair in attrib.compareto
|
||||||
):
|
):
|
||||||
@ -39,5 +41,6 @@ def validate_config(item_attributes: List[Attribute]) -> str:
|
|||||||
ref_attr = attrib_map[ref_attr_name]
|
ref_attr = attrib_map[ref_attr_name]
|
||||||
if ref_attr.html_input_type != attrib.html_input_type:
|
if ref_attr.html_input_type != attrib.html_input_type:
|
||||||
return f"Invalid comparison of '{attrib.attrib_name}' & '{ref_attr_name}' - must be of the same type, {attrib.html_input_type}."
|
return f"Invalid comparison of '{attrib.attrib_name}' & '{ref_attr_name}' - must be of the same type, {attrib.html_input_type}."
|
||||||
|
'''
|
||||||
|
|
||||||
return "Ok"
|
return "Ok"
|
Loading…
Reference in New Issue
Block a user