Fixes in documentation

This commit is contained in:
absurdo 2023-11-04 21:15:44 +01:00
parent cfb70403c1
commit dc58175760
13 changed files with 119 additions and 113 deletions

View file

@ -139,7 +139,7 @@ class DoubleField(FloatField):
return 'DOUBLE NOT NULL DEFAULT "0"'
class CharField(PhangoField):
"""Simple alias for PhangoField for clarify that """
"""Simple alias for PhangoField"""
pass
@ -238,12 +238,12 @@ class ForeignKeyField(IntegerField):
"""
Args:
name (str): Name of field
related_table(WebModel): The table-model related with this foreign key
related_table (WebModel): The table-model related with this foreign key
size (int): The size of the new field in database. By default 11.
required (bool): Boolean for define if field is required or not
identifier_field (str): The Id field name from related table
named_field (str): The field from related table used for identify the row seleted from related table
select_field (list): A series of fields names from related
select_fields (list): A series of fields names from related
"""
super(ForeignKeyField, self).__init__(name, size, required)
@ -292,7 +292,6 @@ class BooleanField(IntegerField):
"""
Args:
name (str): Name of field
related_table(str): The table related with this foreign key
size (int): The size of the new field in database. By default 11.
"""

View file

@ -141,7 +141,7 @@ class SelectForm(BaseForm):
def __init__(self, name, value, elements=OrderedDict()):
"""
Args:
ame (str): The html name for this form
name (str): The html name for this form
value (str): The default value of this html form
elements (OrderedDict): An ordered dict with the keys(the form value) and text label. Example, if you have a OrderedDict how {'0': 'Value selected'} in a html select form you have the next result: <select name="name"><option value="0">Value selected</option></selected>
"""
@ -172,7 +172,6 @@ class SelectModelForm(SelectForm):
Args:
name (str): The html name for this form
value (str): The default value of this html form.
arr_select (OrderedDict): Used for save the data from the webmodel
model (WebModel): The webmodel used for get the data for arr_select
field_name (str): The field used for get the name of every option in select
field_value (str): The field used for get the value of every option in select

View file

@ -741,7 +741,8 @@ class WebModel:
raw_query (bool): If True, if foreignkeyfields exists, are not selected. If False, foreignkeyfields are selected too if foreignkeyfield are in arr_select.
Returns:
Return cursor db for get data using loops or other if operation is successful, if not, return False.
false (bool): If return false, the db connection is down.
sql_cursor (cursor): Return cursor db for get data using loops or other if operation is successful, if not, return False.
"""
@ -865,7 +866,7 @@ class WebModel:
cursor (Db cursor): A typical db cursor of python sql interface standard.
Returns:
dict: Return a dictionary with the row selected.
row (dict): Return a dictionary with the row selected.
"""
@ -906,7 +907,7 @@ class WebModel:
raw_query (bool): If True, if foreignkeyfields exists, are not selected. If False, foreignkeyfields are selected too if foreignkeyfield are in arr_select.
Returns:
dict: Returns dict with the row values.
row (dict): Returns dict with the row values.
"""
self.conditions=['WHERE `'+self.name+'`.`'+self.name_field_id+'`=%s', [id]]
@ -936,7 +937,7 @@ class WebModel:
raw_query (bool): If True, if foreignkeyfields exists, are not selected. If False, foreignkeyfields are selected too if foreignkeyfield are in arr_select.
Returns:
dict: Returns dict with the row values.
row (dict): Returns dict with the row values.
"""
self.limit="limit "+str(begin)+", 1"
@ -963,7 +964,7 @@ class WebModel:
raw_query (bool): If True, if foreignkeyfields exists, are not selected. If False, foreignkeyfields are selected too if foreignkeyfield are in arr_select.
Returns:
dict: Returns dict with the row values.
row_values (dict): Returns dict with the row values.
"""
@ -1013,7 +1014,7 @@ class WebModel:
raw_query (bool): If True, if foreignkeyfields exists, are not selected. If False, foreignkeyfields are selected too if foreignkeyfield are in arr_select.
Returns:
dict: Returns dict with the row values.
row (dict): Returns dict with the row values.
"""
if integer:
@ -1064,12 +1065,11 @@ class WebModel:
"""Method for get a typical sql count using conditions
Args:
Args:
fields_selected (dict): A list with the name of the fields how defined in PhangoField.
field_to_count (str): The field
raw_query (bool): If True, if foreignkeyfields exists, are not selected. If False, foreignkeyfields are selected too if foreignkeyfield are in arr_select.
Returns:
int: Returns the number of elements selected.
num_elecments (int): Returns the number of elements selected.
"""
# Connect to db
@ -1120,7 +1120,7 @@ class WebModel:
"""Method for delete a series of rows using conditions
Returns:
bool: If delete is successfully, return True, if not, return False.
bool (bool): If delete is successfully, return True, if not, return False.
"""
#self.connect_to_db()
@ -1166,7 +1166,7 @@ class WebModel:
in_list (list): List with numbers items.
Returns:
string with (1,2,3) sql sentence filtered.
sql_filtered (str): with (1,2,3) sql sentence filtered.
"""
@ -1185,7 +1185,7 @@ class WebModel:
in_list (list): List with value items.
Returns:
string with (value1, value2, value3) sql sentence filtered.
sql_filtered (str): (value1, value2, value3) sql sentence filtered.
"""
for x in range(0, len(in_list)):
@ -1359,7 +1359,7 @@ class WebModel:
"""Method for drop a table based in this model
Returns:
Return True if table was dropped successfully, false if table can't be dropped.
sql_str (str): Return the sql query for drop the table represented by this model
"""
return self.query('DROP TABLE '+self.name, [], self.connection_id)
@ -1381,8 +1381,10 @@ class WebModel:
errors_set (str): If insert value, the errors are set for insert sql statement, if update value, then the errors are set for update sql statement.
Returns:
Return False if checking is wrong. If not False returns a tuple with fields filtered, original values as values and values filtered how update_values
return (fields, values, update_values)
wrong (bool): Return False if checking is wrong. If not False returns a tuple with fields filtered, original values as values and values filtered how update_values
fields (list): list with fields
values (dict): dict with values
update_values (dict): dict with updated values with checking
"""
fields=[]
@ -1579,7 +1581,7 @@ class WebModel:
"""Get all errors of model last operation.
Returns:
str: A string with all errors.
error_txt (str): A string with all errors.
"""
arr_error=[]
@ -1604,7 +1606,7 @@ class WebModel:
"""Get all errors and save in dictionary
Returns:
dict: Return a dict where the key is the field where the error exists and value is the error text.
errors (dict): Return a dict where the key is the field where the error exists and value is the error text.
"""
arr_error= {}
@ -1666,7 +1668,7 @@ class WebModel:
"""Prepare a dict with values using fields keys how base
Returns:
dict: Return a dict with values without checking anything.
post (dict): Return a dict with values without checking anything.
"""
for k in self.fields.keys():