Cleaner type check

This commit is contained in:
Brian Tiemann 2024-08-26 14:06:31 -04:00
parent 05bcfd7722
commit 8f5162ed02

View File

@ -97,7 +97,7 @@ def qs_filter_from_constraints(constraints, tokens=None):
if type(value) is list:
return list(map(lambda v: tokens.get(v, v), value))
User = apps.get_model('users.User')
if value == CONSTRAINT_TOKEN_USER and type(tokens[CONSTRAINT_TOKEN_USER] is User):
if value == CONSTRAINT_TOKEN_USER and isinstance(tokens.get(CONSTRAINT_TOKEN_USER), User):
return tokens[CONSTRAINT_TOKEN_USER].id
return tokens.get(value, value)