From 1eea7104ad1a637ec7b7f1dff05dc336bfc8bffb Mon Sep 17 00:00:00 2001 From: candifloss Date: Wed, 12 Feb 2025 15:23:27 +0530 Subject: [PATCH] Added "campare" field & comments to Attribute class def --- definitions/attribute.py | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/definitions/attribute.py b/definitions/attribute.py index 4e44cd1..f27f577 100644 --- a/definitions/attribute.py +++ b/definitions/attribute.py @@ -1,15 +1,16 @@ class Attribute: - def __init__(self, display_name, html_input_type="text", required=False, unique=False, primary=False, regex=None, min=None, max=None, options=None, default_val="", auto_increment=False, index=False, comment=""): - self.display_name = display_name - self.html_input_type = html_input_type - self.required = required - self.unique = unique - self.primary = primary - self.regex = regex - self.min = min - self.max = max - self.options = options - self.default_val = default_val - self.auto_increment = auto_increment - self.index = index - self.comment = comment \ No newline at end of file + def __init__(self, display_name, html_input_type="text", required=False, unique=False, primary=False, regex=None, min=None, max=None, options=None, default_val="", auto_increment=False, index=False, comment="", compareto=None): + self.display_name = display_name # Input label or table column header. + self.html_input_type = html_input_type # HTML form input type. Determines MySQL data type. + self.required = required # HTML form input "required" attribute and MySQL "Not Null" constraint + self.unique = unique # MySQL "unique" constraint + self.primary = primary # MySQL "primary key" constraint + self.regex = regex # Regex for value validation + self.min = min # HTML form input "min" attribute. Sets minimum value. + self.max = max # HTML form input "max" attribute. Sets maximum value. + self.options = options # List of options for "select" inputs + self.default_val = default_val # HTML form input "value" attribute. Sets default value. + self.auto_increment = auto_increment # bool: MySQL autoincrement + self.index = index # bool: MySQL index + self.comment = comment # Description text + self.compareto = compareto # Compare to another attribute of the item for validation: ["comparison", "referenceattrib"] \ No newline at end of file