Fixes in docstrings
This commit is contained in:
parent
c91de6863a
commit
1281e385a8
2 changed files with 46 additions and 3 deletions
|
|
@ -39,6 +39,7 @@ class BaseForm:
|
||||||
self.field=None
|
self.field=None
|
||||||
self.required=False
|
self.required=False
|
||||||
self.txt_error=''
|
self.txt_error=''
|
||||||
|
self.error=False
|
||||||
self.name_field_id=self.name+'_form'
|
self.name_field_id=self.name+'_form'
|
||||||
self.help=''
|
self.help=''
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -263,8 +263,18 @@ class WebModel:
|
||||||
Webmodel is a class for create objects that represent models. This models are a mirage of SQL tables. You can create fields, add indexes, foreign keys, and more.
|
Webmodel is a class for create objects that represent models. This models are a mirage of SQL tables. You can create fields, add indexes, foreign keys, and more.
|
||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
arr_sql_index (dict):
|
arr_sql_index (dict): Internal dict used for generate mysql index in fields
|
||||||
|
arr_sql_set_index (dict): Internal dict used for generate mysql index in fields
|
||||||
|
arr_sql_unique (dict): Internal dict used for generate mysql unique values in fields
|
||||||
|
arr_sql_set_unique (dict): Internal dict used for generate mysql unique values in fields
|
||||||
|
last_query (str): The last query execute by WebModel
|
||||||
|
connection_pool (list): A list used in older versions, deprecated
|
||||||
|
first_primary_key (PrimaryKeyField): Field used for primary field and create models in database.
|
||||||
|
model (OrderedDict): Dict used for internal things and create tables.
|
||||||
|
connections (dict): A dict with the configuration of the mysql connection. You can use this element in config.py. You set elements, normally "default" with typical elements how:
|
||||||
|
host: Database host, user: The username of mysql db, password: The password of user, db: The name of the db, charset: The charset of database, normally utf8, db_type: The db_type, possible values are mysqldb or pymysql, by default, pymysql.
|
||||||
|
connection_id (str): The id by default of the selected connection from connections.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__slots__=('sqlclass', 'fields', 'forms')
|
__slots__=('sqlclass', 'fields', 'forms')
|
||||||
|
|
@ -297,12 +307,44 @@ class WebModel:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def connection():
|
def connection():
|
||||||
|
"""Static method for make a connection using SqlClass
|
||||||
|
|
||||||
|
Returns: Return a SqlClass connection for mysql db.
|
||||||
|
"""
|
||||||
|
|
||||||
return SqlClass(WebModel.connections['default'])
|
return SqlClass(WebModel.connections['default'])
|
||||||
|
|
||||||
# Init the class
|
# Init the class
|
||||||
|
|
||||||
def __init__(self, sqlclass=None, name_field_id="id"):
|
def __init__(self, sqlclass=None, name_field_id="id"):
|
||||||
|
"""
|
||||||
|
Args:
|
||||||
|
sqlclass (SqlClass): The SqlClass connection used for the mysql db
|
||||||
|
name_field_id (str): The name of field id of this model/mysql table
|
||||||
|
|
||||||
|
Attributes:
|
||||||
|
name (str): The name of this model correspondient to the sql table name with lower string.
|
||||||
|
label (str): Descriptive name, first is used self.name how default.
|
||||||
|
label_general (str): Descriptive general name, first is used self.name how default.
|
||||||
|
name_field_id (str): The name of field id of this model/mysql table
|
||||||
|
fields (OrderedDict): A dict with the fields of model/table based in PhangoField objects.
|
||||||
|
fields_error (OrderedDict): A dict where the errors when check data fields are saved
|
||||||
|
related (list): A list where related fields are saved.
|
||||||
|
forms (OrderedDict): A dict where forms related with fields using how base BaseForm class are saved if you use self.create_forms() method.
|
||||||
|
errors (dict): A dict where generic errors are saved.
|
||||||
|
num_errors (int): Number of errors generated by the model on query methods.
|
||||||
|
query_error (str): If error in query, saved here.
|
||||||
|
values_query (list): Where the values for a sql query for filtering are saved.
|
||||||
|
conditions (list): A list used for define the sql conditions.
|
||||||
|
First element is the sql condition, Example: 'WHERE id=%s', and second element is the variable to substitute %s, example [1]. Complete example: ['WHERE id=%s', 1]
|
||||||
|
order_by (str): Internal variable used for set the sql order str. You don't shoud change this variable if yo don't know what are you doing.
|
||||||
|
limit (str): Internal variable used for set the sql limit str.
|
||||||
|
related_models_deleted (list): Internal variable used for delete tables from db.
|
||||||
|
required_save (str): Internal variable used for required fields defined in self.fields
|
||||||
|
primary_key (str): Default name of primary key field
|
||||||
|
yes_reset_conditions (bool):
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
self.cached=WebModel.global_cached
|
self.cached=WebModel.global_cached
|
||||||
|
|
||||||
|
|
@ -326,7 +368,7 @@ class WebModel:
|
||||||
|
|
||||||
# Errors of fields of the table, for safe thread reasons.
|
# Errors of fields of the table, for safe thread reasons.
|
||||||
|
|
||||||
self.fields_error=OrderedDict()
|
#self.fields_error=OrderedDict()
|
||||||
|
|
||||||
#The tables related with foreignkeyfield to this table
|
#The tables related with foreignkeyfield to this table
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue