Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value relation order by value #951

Merged
merged 6 commits into from
Oct 10, 2024
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions g3w-admin/qdjango/utils/edittype.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ def __init__(self, **kwargs):
def input_form(self):
return dict()

def make_bool_from_value(self, value)->bool:
"""
From QGIS for widget parameters must be boolean for G3W-CLIENT.
Some time the values of widget parameter may be a boolean or a string/numeric
:param value: the value of a widget parameter
:return: bool
:rtype: bool
"""

return True if value == '1' or value == 'true' or value is True else False


class QgisEditTypeCheckBox(QgisEditType):
"""
Expand Down Expand Up @@ -148,9 +159,11 @@ def input_form(self):

# add params for get value
input_form['input']['options'].update({
'key': self.Value,
'value': self.Key,
'usecompleter': True if self.UseCompleter == '1' or self.UseCompleter == 'true' or self.UseCompleter is True else False,
'key': self.Key,
'value': self.Value,
'usecompleter': self.make_bool_from_value(self.UseCompleter),
'orderbyvalue': self.make_bool_from_value(self.OrderByValue),
'allowmulti': self.make_bool_from_value(self.AllowMulti),
'layer_id': self.Layer,
'loading': {
'state': None
Expand Down
Loading