Added hierarchy_links utility

This commit is contained in:
absurdo 2024-03-01 01:04:06 +01:00
parent bdd149749e
commit 60ef008c58
5 changed files with 156 additions and 2 deletions

View file

@ -263,7 +263,8 @@ class SelectModelForm(SelectForm):
arr_son[arr_value[self.field_parent]]=[]
arr_son[arr_value[self.field_parent]].append([arr_value[self.field_value], self.model.fields[self.field_name].show_formatted(arr_value[self.field_name])])
if arr_value[self.field_value]!=self.model.model_id:
arr_son[arr_value[self.field_parent]].append([arr_value[self.field_value], self.model.fields[self.field_name].show_formatted(arr_value[self.field_name])])
self.create_son(0, arr_son)

View file

@ -352,6 +352,7 @@ class WebModel:
sqlclass (SqlClass): A sql_class used for connect to db.
show_formatted (bool): If True, by default all fields are showed with formatted value using show_formatted method of PhangoField classes and children in select method. If False, raw value is showed.
enctype (bool): If True, forms generated using this model are prepared for enctype=multipart/form-data A.K.A. upload files.
model_id (int): Variable where the actual row from model selected can be saved for different things.
"""
self.cached=WebModel.global_cached
@ -456,6 +457,8 @@ class WebModel:
self.enctype=False
self.model_id=0
self.dummy=0
# A method for add the connection