Skip to content

armgit / wger

Public Imported from GitHub
0

Self hosted FLOSS fitness/workout, nutrition and weight tracker

Replace mutable default argument

Peter van der Does214598f8ca49
diff --git a/wger/gym/forms.py b/wger/gym/forms.py
index ad769361d..83a8e87e2 100644
--- a/wger/gym/forms.py
+++ b/wger/gym/forms.py
@@ -43,12 +43,14 @@ class GymUserPermisssionForm(forms.ModelForm):
role = forms.MultipleChoiceField(choices=ROLES,
initial=USER)
- def __init__(self, available_roles=[], *args, **kwargs):
+ def __init__(self, available_roles=None, *args, **kwargs):
'''
Custom logic to reduce the available permissions
'''
super(GymUserPermisssionForm, self).__init__(*args, **kwargs)
+ if available_roles is None:
+ available_roles = []
field_choices = [(self.USER, _('User'))]
if 'trainer' in available_roles:
field_choices.append((self.TRAINER, _('Trainer')))