filter attributs does not necessary exists
This commit is contained in:
parent
02fd557216
commit
1695cd24ea
@ -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:
|
||||||
|
Loading…
Reference in New Issue
Block a user