Fixes in documentation for db model

This commit is contained in:
Antonio de la Rosa 2022-04-18 13:00:29 +02:00
parent ae3bf3f6c3
commit 3433b3150a
6 changed files with 159 additions and 2 deletions

View file

@ -6,8 +6,19 @@ from paramecio2.libraries.i18n import I18n
from flask import request
class UserModel(WebModel):
"""Model used with basic things for users login and signup
"""
def __init__(self, name_field_id="id"):
"""
Attributes:
password_field (str): The name of the password field to check
email_field (str): The name of the email field to check
username_field (str): The name of the username field to check
yes_repeat_password (bool): If True, check password repeat field, if False, no check repeat password field
check_user (bool): If True, check if user exists in db table, if False, no check that.
check_email (bool): If True, check if email exists in db table, if False, no check that.
"""
super().__init__(name_field_id)
@ -19,6 +30,11 @@ class UserModel(WebModel):
self.check_email=True
def create_forms(self, arr_fields=[]):
"""Method for create forms with checking of repeat password
Args:
arr_fields (list): List of fields used for generate the forms list
"""
# Add password_repeat to forms from the model
@ -53,7 +69,14 @@ class UserModel(WebModel):
"""
def check_all_fields(self, dict_values, external_agent, yes_update=False, errors_set="insert"):
"""Method for check all fields of a model for insert or update a row in table db. Special for UserModel class.
Args:
dict_values (dict): The dict of values to check
external_agent (bool): If True, the query is considered manipulated by external agent and the checks are stricts, if not, checks are not stricts
yes_update (bool): If True, the check need be done for update sql sentence, if False, the check is done for insert sql sentence
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.
"""
error=0
try: