Added more docstrings for libraries
This commit is contained in:
parent
58ff6a1d74
commit
799cfe2125
4 changed files with 140 additions and 15 deletions
|
|
@ -7,7 +7,7 @@ from paramecio2.libraries.i18n import I18n
|
|||
from collections import OrderedDict
|
||||
|
||||
class GenerateAdminClass:
|
||||
"""Class for generate items for a model
|
||||
"""Class for insert, update and list items of a model
|
||||
"""
|
||||
|
||||
def __init__(self, model, url, t):
|
||||
|
|
@ -21,11 +21,20 @@ class GenerateAdminClass:
|
|||
t (PTemplate): Template used for the class. Normally template subclassed from admin_t PTemplate
|
||||
|
||||
Attributes:
|
||||
|
||||
|
||||
model (WebModel) The webmodel used for generatre the admin model form
|
||||
t (PTemplate): Template used for the class. Normally template subclassed from admin_t PTemplate
|
||||
list (SimpleList): A SimpleList class used for generate the listing
|
||||
arr_fields_edit (list): A list with the fields that the user can edit
|
||||
url (str): Base url used by GenerateAdminClass for generate edit, insert and other urls.
|
||||
template_insert (str): The template used for the insert form
|
||||
template_admin (str): The template used for the base admin site
|
||||
template_delete (str): The template used for verify delete of an item
|
||||
url_redirect (str): The url where user is redirect when an operation is done
|
||||
post_update (function): A Function with item id used how argument for make a post-progressing after update.
|
||||
|
||||
"""
|
||||
|
||||
self.model_name=''
|
||||
#self.model_name=''
|
||||
|
||||
self.model=model
|
||||
|
||||
|
|
@ -39,21 +48,21 @@ class GenerateAdminClass:
|
|||
|
||||
self.url=url
|
||||
|
||||
self.safe=0;
|
||||
#self.safe=0;
|
||||
|
||||
self.arr_links={}
|
||||
#self.arr_links={}
|
||||
|
||||
self.hierarchy=None
|
||||
#self.hierarchy=None
|
||||
|
||||
self.text_add_item=''
|
||||
#self.text_add_item=''
|
||||
|
||||
self.no_insert=False
|
||||
#self.no_insert=False
|
||||
|
||||
self.no_delete=False
|
||||
#self.no_delete=False
|
||||
|
||||
self.title=''
|
||||
|
||||
self.id=0
|
||||
#self.id=0
|
||||
|
||||
self.template_insert='utils/insertform.phtml'
|
||||
|
||||
|
|
@ -68,6 +77,12 @@ class GenerateAdminClass:
|
|||
self.text_home=I18n.lang('common', 'home', 'Home')
|
||||
|
||||
def show(self):
|
||||
""" Method for show the admin model
|
||||
|
||||
Depending of op_admin arg, you have the different sections of a simple administrator
|
||||
|
||||
|
||||
"""
|
||||
|
||||
op_admin=request.args.get('op_admin', '0')
|
||||
|
||||
|
|
@ -198,10 +213,31 @@ class GenerateAdminClass:
|
|||
"""
|
||||
|
||||
class GenerateConfigClass:
|
||||
"""Class for generate a simple form for simple data for a configuration
|
||||
"""
|
||||
|
||||
def __init__(self, model, url, t):
|
||||
"""Class for generate a simple form for simple data for a configuration database model
|
||||
|
||||
You can use this class if you need a simple table for configurations. You create the model and you can generate the configuration instancing this class in your admin
|
||||
|
||||
Args:
|
||||
model (WebModel): A WebModel model (equivalent to database mysql table)
|
||||
url (str): A string with the base url for the forms.
|
||||
t (PTemplate): Template used for the class. Normally template subclassed from admin_t PTemplate
|
||||
|
||||
Attributes:
|
||||
model (WebModel) The webmodel used for generatre the admin model form
|
||||
t (PTemplate): Template used for the class. Normally template subclassed from admin_t PTemplate
|
||||
url (str): Base url used by GenerateConfigClass for different sections of update configuration model
|
||||
url_redirect (str): The url where user is redirect when an operation is done
|
||||
arr_fields_edit (list): A list with the fields that the user can edit
|
||||
template_insert (str): The template used for the insert form
|
||||
post_update (function): A Function with item id used how argument for make a post-progressing after update.
|
||||
text_home (str): A str contening the text of home configuration
|
||||
"""
|
||||
|
||||
self.model_name=''
|
||||
#self.model_name=''
|
||||
|
||||
self.model=model
|
||||
|
||||
|
|
@ -225,6 +261,12 @@ class GenerateConfigClass:
|
|||
|
||||
def show(self):
|
||||
|
||||
""" Method for show the config admin model
|
||||
|
||||
Depending of op_config arg, you have the different sections of a simple configuration administrator
|
||||
|
||||
"""
|
||||
|
||||
op_config=request.args.get('op_config', '0')
|
||||
|
||||
if len(self.model.forms)==0:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue