Added docstrings to BaseForm clasess

This commit is contained in:
Antonio de la Rosa 2022-05-06 14:25:58 +02:00
parent fced4d5756
commit 26dd863af8
6 changed files with 31 additions and 0 deletions

View file

@ -3,8 +3,16 @@
from paramecio2.libraries.db.coreforms import BaseForm
class CheckForm(BaseForm):
"""Checkbox form, used normally with boolean fields"""
def __init__(self, name, value, real_value=1):
"""
Args:
name (str): The html name for this form
value (str): The default value of this html form.
real_value (str): Variable used for construct the html form, by default 1.
"""
super(CheckForm, self).__init__(name, value)
self.real_value=real_value

View file

@ -4,6 +4,7 @@ from paramecio2.libraries.db.coreforms import BaseForm
from paramecio2.libraries.mtemplates import standard_t
class ColorForm(BaseForm):
"""Form for get colors from a picker"""
def __init__(self, name, value):

View file

@ -5,6 +5,7 @@ from paramecio2.libraries.mtemplates import standard_t
from paramecio2.libraries.datetime import format_timedata
class DateForm(BaseForm):
"""Create a form for dates, with year, day, hour, minut and seconds"""
def __init__(self, name, value):

View file

@ -8,8 +8,15 @@ env=env_theme(__file__)
t=PTemplate(env)
class FileForm(BaseForm):
"""Class for create a form for upload files. You shoud set enctype to True in your model for it"""
def __init__(self, name, value, path):
"""
Args:
name (str): The html name for this form
value (str): The default value of this html form.
path (str): The path where the file will be saved.
"""
super().__init__(name, value)

View file

@ -6,8 +6,15 @@ from paramecio2.libraries.mtemplates import standard_t
import json
class I18nForm(BaseForm):
"""Form for data with multiple languages."""
def __init__(self, name, value, form):
"""
Args:
name (str): The html name for this form
value (str): The default value of this html form.
form (BaseForm): The form used for generate the multiple languade form. Example if you use a TextForm, a TextForm for every language will be showed.
"""
super().__init__(name, value)

View file

@ -7,8 +7,15 @@ env=env_theme(__file__)
t=PTemplate(env)
class TextHTMLForm(BaseForm):
"""Form for html texts, based in tinycme javascript library"""
def __init__(self, name, value, t_add=None):
"""
Args:
name (str): The html name for this form
value (str): The default value of this html form.
t_add (PTemplate): If you want change the standard html form, use other template loader
"""
super().__init__(name, value)