Commit 1695cd24 authored by Valentin Samir's avatar Valentin Samir

filter attributs does not necessary exists

parent 02fd5572
......@@ -175,8 +175,8 @@ class ServicePattern(models.Model):
if self.restrict_users and not self.usernames.filter(value=user.username):
raise BadUsername()
for filtre in self.filters.all():
if isinstance(user.attributs[filtre.attribut], list):
attrs = user.attributs[filtre.attribut]
if isinstance(user.attributs.get(filtre.attribut, []), list):
attrs = user.attributs.get(filtre.attribut, [])
else:
attrs = [user.attributs[filtre.attribut]]
for value in attrs:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment