Skip to content

Commit

Permalink
Merge pull request #674 from Club-Alpin-Annecy/fix/669
Browse files Browse the repository at this point in the history
[FIX] Fix #669 . Filter activity to not select deprecated role.
  • Loading branch information
jnguiot authored Dec 26, 2023
2 parents 06e805d + 35940a5 commit 845dd73
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion collectives/forms/activity_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ def __init__(self, *args, **kwargs):

activity_list = kwargs.get("activity_list", ActivityType.query.all())

self.activity_id.choices = [(a.id, a.name) for a in activity_list]
self.activity_id.choices = [
(a.id, a.name) for a in activity_list if not a.deprecated
]

if kwargs.get("all_enabled", False):
self.activity_id.choices.append((self.ALL_ACTIVITIES, "Toutes activités"))
Expand Down
2 changes: 1 addition & 1 deletion collectives/forms/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def __init__(self, *args, **kwargs):
"""Overloaded constructor populating activity list"""
super().__init__(*args, **kwargs)
self.activity_type_id.choices = [
(a.id, a.name) for a in ActivityType.get_all_types(True)
(a.id, a.name) for a in ActivityType.get_all_types(True) if not a.deprecated
]


Expand Down

0 comments on commit 845dd73

Please sign in to comment.