wip/75456-Mise-a-jour-django-upgrade-co-po #166

Merged
vdeniaud merged 4 commits from wip/75456-Mise-a-jour-django-upgrade-co-po into main 2023-03-16 16:12:20 +01:00
48 changed files with 152 additions and 168 deletions

View File

@ -2,27 +2,27 @@
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v3.1.0
rev: v3.3.1
hooks:
- id: pyupgrade
args: ['--keep-percent-format', '--py37-plus']
args: ['--keep-percent-format', '--py39-plus']
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.10.0
hooks:
- id: django-upgrade
args: ['--target-version', '3.2']
- repo: https://github.com/psf/black
rev: 22.3.0
rev: 23.1.0
hooks:
- id: black
args: ['--target-version', 'py37', '--skip-string-normalization', '--line-length', '110']
args: ['--target-version', 'py39', '--skip-string-normalization', '--line-length', '110']
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
hooks:
- id: isort
args: ['--profile', 'black', '--line-length', '110']
- repo: https://github.com/rtts/djhtml
rev: 'v1.5.2'
rev: '3.0.5'
hooks:
- id: djhtml
args: ['--tabwidth', '2']

2
debian/control vendored
View File

@ -18,7 +18,7 @@ Architecture: all
Depends: graphviz,
python3-bleach,
python3-distutils,
python3-django (>= 2:2.2),
python3-django (>= 2:3.2),
python3-django-ckeditor,
python3-django-ratelimit,
python3-dnspython,

View File

@ -176,7 +176,7 @@ setup(
url="http://wcs.labs.libre-entreprise.org",
install_requires=[
'Quixote>=3.0,<3.2',
'django>=2.2',
'django>=3.2',
'psycopg2',
'bleach<5',
'dnspython',

View File

@ -1255,7 +1255,6 @@ def test_formdef_submit_structured(pub, local_user):
# varnames with integer as values
{'foobar': 0, 'foobar1': 3},
]:
signed_url = sign_url(
'http://example.net/api/cards/test/submit'
'?format=json&orig=coucou&email=%s' % urllib.parse.quote(local_user.email),

View File

@ -520,7 +520,7 @@ def create_bundle(elements, *args):
tarinfo.size = len(manifest_fd.getvalue())
tar.addfile(tarinfo, fileobj=manifest_fd)
for (path, obj) in args:
for path, obj in args:
tarinfo = tarfile.TarInfo(path)
if hasattr(obj, 'export_for_application'):
export, _ = obj.export_for_application()

View File

@ -792,7 +792,6 @@ def test_user_drafts_categories_filter(pub, local_user):
def test_user_forms_filter_on_status(pub, local_user):
FormDef.wipe()
formdef = FormDef()
formdef.name = 'test'

View File

@ -5104,7 +5104,6 @@ def test_form_autosave_item_field_data_source_error(pub):
# make the ds fails
with mock.patch.object(NamedDataSource, 'get_structured_value', lambda *args: None):
autosave_resp = app.post('/test/autosave', params=resp.form.submit_fields())
assert autosave_resp.json == {
'reason': 'form deserialization failed: a datasource is unavailable (field id: 1)',

View File

@ -5,7 +5,7 @@
<!-- backoffice compat: {{ request.quixote_request.is_in_backoffice|pprint }} -->
<!-- substitution variable: {{ example_url }} -->
<select id="form_{{widget.name}}" name="{{widget.name}}"
{% for attr in widget.attrs.items %}{{attr.0}}="{{attr.1}}"{% endfor %}>
{% for attr in widget.attrs.items %}{{attr.0}}="{{attr.1}}"{% endfor %}>
<option value="">---</option>
{% for option in widget.get_options %}
<option{% for attr in option.attrs.items %} {{attr.0}}="{{attr.1}}"{% endfor %}

View File

@ -522,7 +522,6 @@ def test_ctl_no_command(capsys):
def test_dbshell(pub):
with pytest.raises(CommandError):
call_command('dbshell') # missing tenant name

View File

@ -4522,7 +4522,6 @@ def test_profile(pub):
'=utils.make_date("20/03/2018")',
'=utils.make_date("20/03/2018").timetuple()',
):
# check local value
item.fields = [{'field_id': 'bar', 'value': date_value}]
item.perform(formdata)

View File

@ -775,7 +775,7 @@ class FormDefPage(Directory):
r += self.add_option_line('workflow-options', _('Options'), '')
if self.formdef.workflow.roles:
for (wf_role_id, wf_role_label, role_label) in self.get_workflow_roles_elements():
for wf_role_id, wf_role_label, role_label in self.get_workflow_roles_elements():
r += self.add_option_line('role/%s' % wf_role_id, wf_role_label, role_label)
r += self.add_option_line('roles', _('User Roles'), self.get_roles_label_and_auth_context())
@ -894,7 +894,7 @@ class FormDefPage(Directory):
self.formdef.workflow_roles = {}
workflow_roles = list((self.formdef.workflow.roles or {}).items())
workflow_roles.sort(key=lambda x: '' if x[0] == '_receiver' else misc.simplify(x[1]))
for (wf_role_id, wf_role_label) in workflow_roles:
for wf_role_id, wf_role_label in workflow_roles:
role_id = self.formdef.workflow_roles.get(wf_role_id)
if role_id:
try:

View File

@ -211,7 +211,6 @@ class RolePage(Directory):
class RolesDirectory(Directory):
_q_exports = ["", "new"]
def is_visible(self, *args):

View File

@ -773,7 +773,7 @@ class ApiFormdefsDirectory(Directory):
formdict['functions'] = {}
formdef_workflow_roles = formdef.workflow_roles or {}
for (wf_role_id, wf_role_label) in formdef.workflow.roles.items():
for wf_role_id, wf_role_label in formdef.workflow.roles.items():
workflow_function = {'label': wf_role_label}
role_id = formdef_workflow_roles.get(wf_role_id)
if role_id:

View File

@ -156,7 +156,7 @@ class CardDefPage(FormDefPage):
if self.formdef.workflow.roles:
if not self.formdef.workflow_roles:
self.formdef.workflow_roles = {}
for (wf_role_id, wf_role_label) in self.formdef.workflow.roles.items():
for wf_role_id, wf_role_label in self.formdef.workflow.roles.items():
role_id = self.formdef.workflow_roles.get(wf_role_id)
if role_id:
try:

View File

@ -320,7 +320,6 @@ class CardPage(FormPage):
job.execute()
def _q_lookup(self, component):
view_lookup_response = self._q_lookup_view(component)
if view_lookup_response is not None:
return view_lookup_response

View File

@ -36,7 +36,6 @@ class Command(TenantCommand):
)
def handle(self, filename, domain, if_empty, **options):
publisher = self.init_tenant_publisher(domain)
if not os.path.exists(filename):
raise CommandError('missing file: %s' % filename)

View File

@ -49,7 +49,6 @@ class Command(TenantCommand):
parser.add_argument('filenames', metavar='FILENAME', nargs='+')
def handle(self, filenames, domain, trigger, workflow_id, formdef_id, all_formdata, verbosity, **options):
self.init_tenant_publisher(domain)
if not all_formdata:

View File

@ -262,7 +262,6 @@ def get_id_by_option_text(data_source, text_value):
def get_json_from_url(
url, data_source=None, log_message_part='JSON data source', raise_request_error=False, cache_duration=0
):
if cache_duration:
cache_key = 'data-source-cache-%s' % get_cache_key(url, data_source)
entries = cache.get(cache_key)
@ -770,7 +769,7 @@ class NamedDataSource(XmlStorableObject):
def export_qs_data_to_xml(self, element, attribute_name, *args, **kwargs):
if not self.qs_data:
return
for (key, value) in self.qs_data.items():
for key, value in self.qs_data.items():
item = ET.SubElement(element, 'item')
if isinstance(key, str):
ET.SubElement(item, 'name').text = force_str(key)

View File

@ -1741,7 +1741,7 @@ class FormData(StorableObject):
# looking for any object (inspect page)
data_ids.append((part_identifier, part.formdata_id, _('Evolution')))
for (slug, target_id, origin) in data_ids:
for slug, target_id, origin in data_ids:
if object_type:
# workflow action
try:

View File

@ -1011,7 +1011,6 @@ class FormDef(StorableObject):
root['required_authentication_contexts'] = self.required_authentication_contexts[:]
if isinstance(self, CardDef):
all_carddefs = CardDef.select(ignore_errors=True)
all_carddefs = [c for c in all_carddefs if c]
all_carddefs_by_slug = {c.url_name: c for c in all_carddefs}

View File

@ -275,7 +275,6 @@ _re_subst = re.compile('%(%|[0-9]+)')
class Template:
_printers = {
FORMAT_RAW: '_cmd_print',
FORMAT_HTML: '_cmd_print_html',

View File

@ -1846,7 +1846,6 @@ class WidgetList(quixote.form.widget.WidgetList):
max_items=None,
**kwargs,
):
if add_element_label == 'Add row':
add_element_label = str(_('Add row'))

View File

@ -278,7 +278,6 @@ class MethodDirectory(Directory):
return self.login_submit_account_user(account, user, form)
def login_submit_account_user(self, account, user, form=None):
if account.awaiting_confirmation:
if form:
form.set_error('username', _('This account is waiting for confirmation'))

View File

@ -1,41 +1,41 @@
<div class="{% block widget-css-classes %}widget {{widget.class_name}} {{widget.extra_css_class}}
{% if widget.readonly %}widget-readonly{% endif %}
{% if widget.get_error %}widget-with-error{% endif %}
{% if widget.is_required %}widget-required{% else %}widget-optional{% endif %}
{% if widget.is_prefilled %}widget-prefilled{% endif %}{% endblock %}"
{% block widget-attrs %}
{% if widget.is_hidden %}style="display: none"{% endif %}
{% if widget.field %}data-field-id="{{ widget.field.id }}"{% endif %}
data-widget-name="{{ widget.name }}"
{% if widget.div_id %}id="{{widget.div_id}}" data-valuecontainerid="form_{{widget.name}}"{% endif %}
{% if widget.a11y_role %}role="{{ a11y_role }}"{% endif %}
{% if widget.a11y_labelledby %}aria-labelledby="form_label_{{widget.name}}"{% endif %}
{% for attr in widget.prefill_attributes %}
data-{{attr}}="{{widget.prefill_attributes|get:attr}}"
{% endfor %}
{% if "data-dynamic-display-child-of" in widget.attrs %}
data-dynamic-display-child-of="{{widget.attrs|get:"data-dynamic-display-child-of"}}"
{% endif %}
{% if "data-dynamic-display-value" in widget.attrs %}
data-dynamic-display-value="{{widget.attrs|get:"data-dynamic-display-value"}}"
{% endif %}
{% if "data-dynamic-display-value-in" in widget.attrs %}
data-dynamic-display-value-in="{{widget.attrs|get:"data-dynamic-display-value-in"}}"
{% endif %}
{% if "data-dynamic-display-checked" in widget.attrs %}
data-dynamic-display-checked="{{widget.attrs|get:"data-dynamic-display-checked"}}"
{% endif %}
{% if widget.live_condition_source %}data-live-source="true"{% endif %}
{% endblock %}
{% if widget.readonly %}widget-readonly{% endif %}
{% if widget.get_error %}widget-with-error{% endif %}
{% if widget.is_required %}widget-required{% else %}widget-optional{% endif %}
{% if widget.is_prefilled %}widget-prefilled{% endif %}{% endblock %}"
{% block widget-attrs %}
{% if widget.is_hidden %}style="display: none"{% endif %}
{% if widget.field %}data-field-id="{{ widget.field.id }}"{% endif %}
data-widget-name="{{ widget.name }}"
{% if widget.div_id %}id="{{widget.div_id}}" data-valuecontainerid="form_{{widget.name}}"{% endif %}
{% if widget.a11y_role %}role="{{ a11y_role }}"{% endif %}
{% if widget.a11y_labelledby %}aria-labelledby="form_label_{{widget.name}}"{% endif %}
{% for attr in widget.prefill_attributes %}
data-{{attr}}="{{widget.prefill_attributes|get:attr}}"
{% endfor %}
{% if "data-dynamic-display-child-of" in widget.attrs %}
data-dynamic-display-child-of="{{widget.attrs|get:"data-dynamic-display-child-of"}}"
{% endif %}
{% if "data-dynamic-display-value" in widget.attrs %}
data-dynamic-display-value="{{widget.attrs|get:"data-dynamic-display-value"}}"
{% endif %}
{% if "data-dynamic-display-value-in" in widget.attrs %}
data-dynamic-display-value-in="{{widget.attrs|get:"data-dynamic-display-value-in"}}"
{% endif %}
{% if "data-dynamic-display-checked" in widget.attrs %}
data-dynamic-display-checked="{{widget.attrs|get:"data-dynamic-display-checked"}}"
{% endif %}
{% if widget.live_condition_source %}data-live-source="true"{% endif %}
{% endblock %}
>
{% block widget-title %}
{{widget.rendered_title}}
{% endblock %}
{% block widget-content %}
<div class="content {{widget.content.content_extra_css_class}}"
{% for attr, value in widget.content_extra_attributes.items %}
{{attr}}="{{value}}"
{% endfor %}
{% for attr, value in widget.content_extra_attributes.items %}
{{attr}}="{{value}}"
{% endfor %}
>
{% block widget-error %}{{widget.rendered_error}}{% endblock %}
{% block widget-control %}{{widget.render_content|safe}}{% endblock %}

View File

@ -1,6 +1,6 @@
<div {% if widget.field.id %}data-field-id="{{ widget.field.id }}"{% endif %}
{% if widget.is_hidden %}style="display: none"{% endif %}
class="comment-field {{widget.extra_css_class|default_if_none:"" }}">
{% if widget.is_hidden %}style="display: none"{% endif %}
class="comment-field {{widget.extra_css_class|default_if_none:"" }}">
{% block widget-content %}
{{ widget.content|safe }}
{% endblock %}

View File

@ -7,33 +7,33 @@
{# Y-m-d format, or including a date input with an ineffective reset × button. #}
<input type="hidden" name="{{widget.name}}" {% if widget.value %}value="{{ widget.value|date:"Y-m-d" }}"{% endif %}>
<input type="text" {% if widget.value %}value="{{ widget.value|date }}"{% endif %}
{% else %}
{% else %}
{# otherwise, use an <input type="date"> but also include js datetime picker #}
{# attributes, in case it's not supported. #}
<input name="{{widget.name}}" {% if widget.value %}value="{{ widget.value|date:"Y-m-d" }}"{% endif %}
type="date"
{% if widget.value %}data-formatted-value="{{ widget.value|default:"" }}"{% endif %}
class="date-pick"
data-date-format="{{widget.date_format}}"
<input name="{{widget.name}}" {% if widget.value %}value="{{ widget.value|date:"Y-m-d" }}"{% endif %}
type="date"
{% if widget.value %}data-formatted-value="{{ widget.value|default:"" }}"{% endif %}
class="date-pick"
data-date-format="{{widget.date_format}}"
{# set widget not to go into the time pages #}
data-min-view="2"
data-min-view="2"
{# if there is no value we set the initial view to be the view of decades, #}
{# it is more appropriate to select a far away date. #}
data-start-view="{% if widget.value %}2{% else %}4{% endif %}"
data-start-view="{% if widget.value %}2{% else %}4{% endif %}"
{% if widget.minimum_date %}
data-start-date="{{ widget.start_date }}"
min="{{widget.minimum_date|date:"Y-m-d"}}"
{% endif %}
{% if widget.maximum_date %}
data-end-date="{{ widget.end_date }}"
max="{{widget.maximum_date|date:"Y-m-d"}}"
{% endif %}
{% endif %}
id="form_{{widget.get_name_for_id}}"
{% for attr in widget.attrs.items %}{{attr.0}}="{{attr.1}}" {% endfor %}
{% if widget.required %}aria-required="true"{% endif %}
{% if widget.minimum_date %}
data-start-date="{{ widget.start_date }}"
min="{{widget.minimum_date|date:"Y-m-d"}}"
{% endif %}
{% if widget.maximum_date %}
data-end-date="{{ widget.end_date }}"
max="{{widget.maximum_date|date:"Y-m-d"}}"
{% endif %}
{% endif %}
id="form_{{widget.get_name_for_id}}"
{% for attr in widget.attrs.items %}{{attr.0}}="{{attr.1}}" {% endfor %}
{% if widget.required %}aria-required="true"{% endif %}
>
{% endblock %}

View File

@ -3,7 +3,7 @@
{% block widget-control %}
<div class="file-button {% if widget.is_image %}file-image{% endif %}"
{% if widget.automatic_image_resize %}data-image-resize="true"{% endif %}>
{% if widget.automatic_image_resize %}data-image-resize="true"{% endif %}>
{% for w in widget.get_widgets %}
{{ w.render|safe }}
{% endfor %}
@ -15,12 +15,12 @@
</div>
<div class="fileprogress" style="display: none;">
<div class="bar"
role="progressbar"
aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" aria-valuetext="0%"
aria-label="" tabindex="-1"
data-upload="{% trans "Upload in progress..." %}"
data-resize="{% trans "Resizing image..." %}"
data-error="{% trans "Error during upload." %}"></div>
role="progressbar"
aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" aria-valuetext="0%"
aria-label="" tabindex="-1"
data-upload="{% trans "Upload in progress..." %}"
data-resize="{% trans "Resizing image..." %}"
data-error="{% trans "Error during upload." %}"></div>
</div>
<div class="fileinfo {% if widget.readonly and widget.has_tempfile_image %}thumbnail{% endif %}">
<p class="filename">{% if widget.tempfile and not widget.is_remote_storage %}<a

View File

@ -3,14 +3,14 @@
{% block widget-control %}
<input type="hidden" name="{{widget.name}}$latlng" {% if widget.value %}value="{{widget.value}}"{% endif %}>
<div id="map-{{widget.get_name_for_id}}" class="qommon-map"
{% if widget.readonly %}data-readonly="true"{% endif %}
{% if widget.sync_map_and_address_fields %}data-address-sync="true"{% endif %}
{% for key, value in widget.map_attributes.items %}{{key}}="{{value}}" {% endfor %}
{% if widget.initial_position %}
data-init-lat="{{ widget.initial_position.lat }}"
data-init-lng="{{ widget.initial_position.lng }}"
{% endif %}
data-search-url="{% url 'api-geocoding' %}"
{% block widget-control-attributes %}{% endblock %}
{% if widget.readonly %}data-readonly="true"{% endif %}
{% if widget.sync_map_and_address_fields %}data-address-sync="true"{% endif %}
{% for key, value in widget.map_attributes.items %}{{key}}="{{value}}" {% endfor %}
{% if widget.initial_position %}
data-init-lat="{{ widget.initial_position.lat }}"
data-init-lng="{{ widget.initial_position.lng }}"
{% endif %}
data-search-url="{% url 'api-geocoding' %}"
{% block widget-control-attributes %}{% endblock %}
></div>
{% endblock %}

View File

@ -1,9 +1,9 @@
{% extends "qommon/forms/widget.html" %}
{% block widget-control %}
<textarea style="width: 100%" id="form_{{widget.get_name_for_id}}" name="{{widget.name}}"
{% for attr in widget.attrs.items %}{{attr.0}}="{{attr.1}}" {% endfor %}
{% if widget.live_condition_source %}data-godo-instant-update="true"{% endif %}
data-godo-schema="{{widget.EDITION_MODE}}"> {{widget.value|default:""}}
{% for attr in widget.attrs.items %}{{attr.0}}="{{attr.1}}" {% endfor %}
{% if widget.live_condition_source %}data-godo-instant-update="true"{% endif %}
data-godo-schema="{{widget.EDITION_MODE}}"> {{widget.value|default:""}}
</textarea>
<script type="module" src="/static/xstatic/js/godo.js?{{version_hash}}"></script>
{% endblock %}

View File

@ -5,13 +5,13 @@
{% block widget-control %}
{% for option in widget.get_options %}
<label for="{{ widget.get_name_for_id }}_op_{{ forloop.counter0 }}"
{% if option.disabled %}class="disabled"{% endif %}><input
id="{{ widget.get_name_for_id }}_op_{{ forloop.counter0 }}"
{% if option.selected %}checked="checked"
{% elif widget.readonly or option.disabled %}disabled="disabled"{% endif %}
{% for attr in widget.attrs.items %}{{attr.0}}="{{attr.1}}" {% endfor %}
type="radio" name="{{ widget.name }}"
value="{{ option.value }}"><span>{{ option.label }}</span></label>
{% if option.disabled %}class="disabled"{% endif %}><input
id="{{ widget.get_name_for_id }}_op_{{ forloop.counter0 }}"
{% if option.selected %}checked="checked"
{% elif widget.readonly or option.disabled %}disabled="disabled"{% endif %}
{% for attr in widget.attrs.items %}{{attr.0}}="{{attr.1}}" {% endfor %}
type="radio" name="{{ widget.name }}"
value="{{ option.value }}"><span>{{ option.label }}</span></label>
{% if not forloop.last %}{{ widget.delim|safe }}{% endif %}
{% endfor %}
{% endblock %}

View File

@ -2,14 +2,14 @@
{% load qommon i18n %}
{% block widget-control %}
<select style="display: none" id="form_{{widget.get_name_for_id}}" name="{{widget.name}}"
{% for attr in widget.attrs.items %}{{attr.0}}="{{attr.1}}"{% endfor %}>
{% for attr in widget.attrs.items %}{{attr.0}}="{{attr.1}}"{% endfor %}>
<option value="">---</option>
{% for option in widget.get_options %}
{% with datetime=option.options.datetime|parse_datetime %}
<option{% for attr in option.attrs.items %} {{attr.0}}="{{attr.1}}"{% endfor %}
data-weekday="{{ datetime|date:"l" }}"
data-date="{{ datetime|date:"Y-m-d" }}"
data-time="{{ datetime|date:"H:i" }}"
data-weekday="{{ datetime|date:"l" }}"
data-date="{{ datetime|date:"Y-m-d" }}"
data-time="{{ datetime|date:"H:i" }}"
>{{ option.description }}</option>
{% endwith %}
{% endfor %}

View File

@ -1,9 +1,9 @@
{% extends "qommon/forms/widget.html" %}
{% block widget-control %}
<select id="form_{{widget.get_name_for_id}}" name="{{widget.name}}"
{% if widget.select2 %}data-autocomplete="true"{% endif %}
{% if widget.required %}data-required="true"{% endif %}
{% for attr in widget.attrs.items %}{% if attr.0 != 'readonly' %}{{attr.0}}="{{attr.1}}"{% endif %}{% endfor %}>
{% if widget.select2 %}data-autocomplete="true"{% endif %}
{% if widget.required %}data-required="true"{% endif %}
{% for attr in widget.attrs.items %}{% if attr.0 != 'readonly' %}{{attr.0}}="{{attr.1}}"{% endif %}{% endfor %}>
{% if not widget.separate_hint and widget.hint %}
<option value="" data-hint="{{ widget.hint }}">{% if not widget.select2 %}{{ widget.hint }}{% endif %}</option>
{% endif %}

View File

@ -3,21 +3,21 @@
{% block widget-control %}
<div class="wcs-widget-select2-container">
<select id="form_{{widget.get_name_for_id}}" name="{{widget.name}}"
data-select2-url="{{widget.get_select2_url}}"
{% if widget.value %}data-value="{{ widget.value }}"{% endif %}
data-required="{% if widget.is_required %}true{% endif %}"
data-initial-display-value="{{widget.get_display_value|default_if_none:''}}"
{% if widget.edit_related %}data-initial-edit-related-url="{{widget.get_edit_related_url|default_if_none:''}}"{% endif %}>
data-select2-url="{{widget.get_select2_url}}"
{% if widget.value %}data-value="{{ widget.value }}"{% endif %}
data-required="{% if widget.is_required %}true{% endif %}"
data-initial-display-value="{{widget.get_display_value|default_if_none:''}}"
{% if widget.edit_related %}data-initial-edit-related-url="{{widget.get_edit_related_url|default_if_none:''}}"{% endif %}>
</select>
{% if widget.add_related_url %}
<a class="add-related pk-button" id="add_form_{{ widget.get_name_for_id }}"
href="{{ widget.add_related_url }}?_popup=1"
title="{% blocktrans with card=widget.get_title %}Add another {{ card }}{% endblocktrans %}">+</a>
href="{{ widget.add_related_url }}?_popup=1"
title="{% blocktrans with card=widget.get_title %}Add another {{ card }}{% endblocktrans %}">+</a>
{% endif %}
{% if widget.edit_related %}
<a class="edit-related pk-button" id="edit_form_{{ widget.get_name_for_id }}"
style="display: none"
title="{% blocktrans with card=widget.get_title %}Edit selected {{ card }}{% endblocktrans %}"
style="display: none"
title="{% blocktrans with card=widget.get_title %}Edit selected {{ card }}{% endblocktrans %}"
>{% blocktrans with card=widget.get_title %}Edit selected {{ card }}{% endblocktrans %}</a>
{% endif %}
</div>

View File

@ -2,22 +2,22 @@
{% block widget-control %}
<input id="form_{{widget.get_name_for_id}}" name="{{widget.name}}"
type="{% if "readonly" in widget.attrs %}text{% else %}time{% endif %}"
{% for attr in widget.attrs.items %}{{attr.0}}="{{attr.1}}" {% endfor %}
{% if widget.required %}aria-required="true"{% endif %}
{% if "readonly" in widget.attrs %}
{% if widget.value %}value="{{ widget.value }}"{% endif %}
{% else %}
type="{% if "readonly" in widget.attrs %}text{% else %}time{% endif %}"
{% for attr in widget.attrs.items %}{{attr.0}}="{{attr.1}}" {% endfor %}
{% if widget.required %}aria-required="true"{% endif %}
{% if "readonly" in widget.attrs %}
{% if widget.value %}value="{{ widget.value }}"{% endif %}
{% else %}
value="{{ widget.value|default:"" }}" data-formatted-value="{{ widget.value|default:"" }}"
class="date-pick"
data-date-format="hh:ii"
value="{{ widget.value|default:"" }}" data-formatted-value="{{ widget.value|default:"" }}"
class="date-pick"
data-date-format="hh:ii"
data-min-view="0"
data-max-view="0"
data-start-view="0"
data-min-view="0"
data-max-view="0"
data-start-view="0"
{% endif %}
{% endif %}
>
{% endblock %}

View File

@ -21,7 +21,6 @@ from .qommon.sessions import Session
class BasicSession(Session):
magictokens = None
anonymous_formdata_keys = None
visiting_objects = None

View File

@ -29,7 +29,7 @@
<ul>
{% for report_line in category.list %}
<li class="{{ report_line.css_class|default:"" }}"><a href="{{ report_line.url }}"
>{{ report_line.location_label }}</a></li>
>{{ report_line.location_label }}</a></li>
{% endfor %}
</ul>
</div>

View File

@ -17,14 +17,14 @@
<span>
<label>{% trans "Search:" %} <input type="search" name="q" value="{{q|default:""}}"></label>
<label><input name="non_translatable" type="checkbox"
{% if non_translatable %}checked{% endif %}
>{% trans "Search non-translatable strings" %}</label>
{% if non_translatable %}checked{% endif %}
>{% trans "Search non-translatable strings" %}</label>
</span>
<fieldset class="radiogroup"><legend>{% trans "Language:" %}</legend>
{% for language in supported_languages %}
<input type="radio" name="lang" value="{{language.0}}" id="radio-lang-{{language.0}}"
onchange="this.form.submit()"
{% if language.0 == selected_language %}checked{% endif %}
onchange="this.form.submit()"
{% if language.0 == selected_language %}checked{% endif %}
><label for="radio-lang-{{language.0}}">{{language.1}}</label>
{% endfor %}
</fieldset>

View File

@ -1,5 +1,5 @@
<div class="inspect-field inspect-field--{{ field.key }} {% if forloop.first %}inspect-field--first{% endif %}"
data-field-id="{{ field.id }}">
data-field-id="{{ field.id }}">
<h4><a href="{{ path|default:"fields/" }}{{ field.id }}/">{{ field.ellipsized_label }}</a>
<span class="inspect-field-type">-
{% if field.key == 'block' %}<a href="{{ field.block.get_admin_url }}inspect">{% endif %}

View File

@ -29,17 +29,17 @@
<div id="journal-page-links">
<a class="button first-page {% if no_prev%}disabled{% endif %}"
title="{% trans "Most recent activity" %}"
href="./?{{ extra_qs }}"><span class="sr-only">{% trans "First page" %}</span></a>
title="{% trans "Most recent activity" %}"
href="./?{{ extra_qs }}"><span class="sr-only">{% trans "First page" %}</span></a>
<a class="button previous-page {% if no_prev%}disabled{% endif %}"
title="{% trans "More recent activity" %}"
href="./?min={{ last_row_id }}&{{ extra_qs }}"><span class="sr-only">{% trans "Previous page" %}</span></a>
title="{% trans "More recent activity" %}"
href="./?min={{ last_row_id }}&{{ extra_qs }}"><span class="sr-only">{% trans "Previous page" %}</span></a>
<a class="button next-page {% if no_next %}disabled{% endif %}"
title="{% trans "More ancient activity" %}"
href="./?max={{ first_row_id }}&{{ extra_qs }}"><span class="sr-only">{% trans "Next page" %}</span></a>
title="{% trans "More ancient activity" %}"
href="./?max={{ first_row_id }}&{{ extra_qs }}"><span class="sr-only">{% trans "Next page" %}</span></a>
<a class="button last-page {% if no_next %}disabled{% endif %}"
title="{% trans "Most ancient activity" %}"
href="./?max={{ latest_page_id }}&{{ extra_qs }}"><span class="sr-only">{% trans "Last page" %}</span></a>
title="{% trans "Most ancient activity" %}"
href="./?max={{ latest_page_id }}&{{ extra_qs }}"><span class="sr-only">{% trans "Last page" %}</span></a>
</div>
{% endblock %}

View File

@ -3,9 +3,9 @@
<head><title>{% trans 'Popup closing...' %}</title></head>
<body>
<script type="text/javascript"
id="popup-response-constants"
src="{% static "js/popup_response.js" %}"
data-popup-response="{{ popup_response_data }}">
id="popup-response-constants"
src="{% static "js/popup_response.js" %}"
data-popup-response="{{ popup_response_data }}">
</script>
</body>
</html>

View File

@ -13,6 +13,6 @@
<div class="done" style="display: none">
<a {% for attr in job.done_button_attributes.items %}{{ attr.0 }}="{{ attr.1 }}"{% endfor %}
class="button" href="{{ job.done_action_url }}">{{ job.done_action_label }}</a>
class="button" href="{{ job.done_action_url }}">{{ job.done_action_label }}</a>
</div>
{% endblock %}

View File

@ -39,7 +39,7 @@
<td colspan="2">
{{ snapshot.timestamp }}
{% if snapshot.new_day and snapshot.day_other_count %} — <a class="reveal"
href="#day-{{ snapshot.timestamp|date:"Y-m-d"}}">
href="#day-{{ snapshot.timestamp|date:"Y-m-d"}}">
{% if snapshot.day_other_count >= 50 %}<strong>{% endif %}
{% blocktrans trimmed count counter=snapshot.day_other_count %}
1 other this day

View File

@ -28,7 +28,7 @@
{% spaceless %}
{% for status in workflow.possible_status %}
<li class="biglistitem {% if status.get_visibility_restricted_roles %}hidden-status{% endif %}"
id="itemId_{{ status.id }}">
id="itemId_{{ status.id }}">
<a href="status/{{ status.id }}/" {% if status.colour %}style="border-color: #{{status.colour}}"{% endif %}
>{{ status.name }}</a></li>
{% endfor %}
@ -111,7 +111,7 @@
{% spaceless %}
{% for level in workflow.criticality_levels %}
<li class="biglistitem" id="itemId_{{ level.id }}"
{% if level.colour %}style="border-left-color: #{{ level.colour }}"{% endif %}>
{% if level.colour %}style="border-left-color: #{{ level.colour }}"{% endif %}>
<a rel="popup" href="criticality-levels/{{ level.id }}">{{ level.name }}</a>
</li>
{% endfor %}

View File

@ -8,8 +8,8 @@
{% for evolution in formdata.get_visible_evolution_parts %}
{% with status=evolution.get_status display_parts=evolution.display_parts %}
<li class="{% if evolution.who == '_submitter' %}msg-in{% elif evolution.who %}msg-out{% else %}msg-system{% endif %}
{% if status.is_endpoint %}endpoint{% endif %}
{{ status.extra_css_class|default:"" }}">
{% if status.is_endpoint %}endpoint{% endif %}
{{ status.extra_css_class|default:"" }}">
<span class="item {% if not evolution.status %}no-status-change{% endif %}" style="background: #{{ status.colour }}; color: {{ status.get_contrast_color}}"></span>
<div>
{% if evolution.status %}

View File

@ -5,10 +5,10 @@
{% for page_label in page_labels %}
{% spaceless %}
<li class="{% if forloop.first %}first{% endif %}
{% if forloop.last %}last{% endif %}
{% if forloop.counter == current_page_no %}current{% endif %}
{% if forloop.counter < current_page_no %}step-before{% endif %}
{% if forloop.counter > current_page_no %}step-after{% endif %}" >
{% if forloop.last %}last{% endif %}
{% if forloop.counter == current_page_no %}current{% endif %}
{% if forloop.counter < current_page_no %}step-before{% endif %}
{% if forloop.counter > current_page_no %}step-after{% endif %}" >
<span class="marker">{{ forloop.counter }}</span>
<span class="label">{{ page_label }}</span>
</li>

View File

@ -63,7 +63,6 @@ class ManyExternalCallsPart(EvolutionPart):
class ExternalWorkflowGlobalAction(WorkflowStatusItem):
description = _('External workflow')
key = 'external_workflow_global_action'
category = 'formdata-action'

View File

@ -610,7 +610,7 @@ class WebserviceCallStatusItem(WorkflowStatusItem):
if not getattr(self, attribute):
return
el = ET.SubElement(xml_item, attribute)
for (key, value) in getattr(self, attribute).items():
for key, value in getattr(self, attribute).items():
item = ET.SubElement(el, 'item')
if isinstance(key, str):
ET.SubElement(item, 'name').text = force_str(key)

View File

@ -131,7 +131,7 @@ def call_webservice(
if method in ('PATCH', 'PUT', 'POST') and post_data:
payload = {}
with get_publisher().complex_data():
for (key, value) in post_data.items():
for key, value in post_data.items():
try:
payload[key] = WorkflowStatusItem.compute(value, allow_complex=True, raises=True)
except Exception as e: