Skip to content

Commit

Permalink
Allow displaying assigned_user field in Report Form via conf if needed (
Browse files Browse the repository at this point in the history
  • Loading branch information
Chatewgne committed Aug 20, 2024
1 parent 9f59350 commit 0ee2855
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ CHANGELOG
**Improvements**

- Allow use of Annotation Categories on annotations other than Points (#4032)"
- Allow using custom.py to make assigned_user field in Report Form available (#4085)


2.109.0 (2024-08-08)
Expand Down
3 changes: 3 additions & 0 deletions docs/install/advanced-configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2600,6 +2600,9 @@ An exhaustive list of form fields hideable in each module.
HIDDEN_FORM_FIELDS["circulationedge"] = [
]
.. note::
``assigned_user`` is hidden by default in ``HIDDEN_FORM_FIELDS["report"]``, it is possible to force it to appear using ``HIDDEN_FORM_FIELDS["report"] = []``.


Configure form fields required or needed for review or publication
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down
1 change: 0 additions & 1 deletion geotrek/feedback/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,6 @@ def __init__(self, *args, **kwargs):
self.fields["assigned_user"].widget = HiddenInput()
self.fields["uses_timers"].widget = HiddenInput()
else: # Do not use these fields outside of worflow
self.fields["assigned_user"].widget = HiddenInput()
self.fields["uses_timers"].widget = HiddenInput()

def save(self, *args, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion geotrek/feedback/tests/test_suricate_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ def inner(self, *args, **kwargs):
def test_for_workflow_mode(test_func):
def inner(self, *args, **kwargs):
try:
with override_settings(SURICATE_REPORT_ENABLED=True, SURICATE_WORKFLOW_ENABLED=True):
with override_settings(SURICATE_REPORT_ENABLED=True, SURICATE_WORKFLOW_ENABLED=True, HIDDEN_FORM_FIELDS={}):
test_func(self, *args, **kwargs)
except AssertionError as e:
e.args += ("Failed for 'Suricate Workflow' mode",)
Expand Down
5 changes: 4 additions & 1 deletion geotrek/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ def api_bbox(bbox, buffer):
PARSER_RETRY_HTTP_STATUS = [503]

USE_BOOKLET_PDF = False
HIDDEN_FORM_FIELDS = {}
HIDDEN_FORM_FIELDS = {'report': ['assigned_user']}
COLUMNS_LISTS = {}
ENABLE_JOBS_COSTS_DETAILED_EXPORT = False

Expand Down Expand Up @@ -925,3 +925,6 @@ def api_bbox(bbox, buffer):
]
LEAFLET_CONFIG['TILES_EXTENT'] = SPATIAL_EXTENT
LEAFLET_CONFIG['SPATIAL_EXTENT'] = api_bbox(SPATIAL_EXTENT, VIEWPORT_MARGIN)

if SURICATE_WORKFLOW_ENABLED and 'report' in HIDDEN_FORM_FIELDS.keys() and "assigned_user" in HIDDEN_FORM_FIELDS['report']:
HIDDEN_FORM_FIELDS['report'].remove("assigned_user")

0 comments on commit 0ee2855

Please sign in to comment.