Commit e54d3f1e authored by Filippos Giannakos's avatar Filippos Giannakos

admin: Fix broken tests

parent f910dc2b
......@@ -37,9 +37,16 @@ def get_actual_owner(inst):
def get_project_or_404(query, for_update=False):
project_obj = Project.objects.select_for_update() if for_update\
else Project.objects
if isinstance(query, basestring):
q = Q(id=int(query)) if query.isdigit() else Q(uuid=query)
elif isinstance(query, int) or isinstance(query, long):
q = Q(id=int(query))
else:
raise TypeError("Unexpected type of query")
try:
return project_obj.get(Q(id=int(query)) if query.isdigit()
else Q(uuid=query))
return project_obj.get(q)
except ObjectDoesNotExist:
raise AdminHttp404(
"No Project was found that matches this query: %s\n" % query)
......
......@@ -42,7 +42,14 @@ def get_user_or_404(query, for_update=False):
"""
usr_obj = AstakosUser.objects.select_for_update() if for_update\
else AstakosUser.objects
q = Q(id=int(query)) if query.isdigit() else Q(uuid=query) | Q(email=query)
if isinstance(query, basestring):
q = Q(id=int(query)) if query.isdigit() else Q(uuid=query) | Q(email=query)
elif isinstance(query, int) or isinstance(query, long):
q = Q(id=int(query))
else:
raise TypeError("Unexpected type of query")
try:
return usr_obj.get(q)
except ObjectDoesNotExist:
......
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