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

filter attributs does not necessary exists

parent 02fd5572
...@@ -175,8 +175,8 @@ class ServicePattern(models.Model): ...@@ -175,8 +175,8 @@ class ServicePattern(models.Model):
if self.restrict_users and not self.usernames.filter(value=user.username): if self.restrict_users and not self.usernames.filter(value=user.username):
raise BadUsername() raise BadUsername()
for filtre in self.filters.all(): for filtre in self.filters.all():
if isinstance(user.attributs[filtre.attribut], list): if isinstance(user.attributs.get(filtre.attribut, []), list):
attrs = user.attributs[filtre.attribut] attrs = user.attributs.get(filtre.attribut, [])
else: else:
attrs = [user.attributs[filtre.attribut]] attrs = [user.attributs[filtre.attribut]]
for value in attrs: 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