Commit 900e63fd authored by Philip ABBET's avatar Philip ABBET
Browse files

[databases, api] Can't retrieve a database template that doesn't correspond to an usable database

parent 2b950903
......@@ -139,7 +139,10 @@ class ListTemplatesView(views.APIView):
result = {}
# Retrieve all the protocols available to user
for set_template in DatabaseSetTemplate.objects.filter(sets__protocol__database__in=Database.objects.for_user(request.user, True)).distinct().order_by('name'):
databases = Database.objects.for_user(request.user, True)
databases = Database.filter_latest_versions(databases)
for set_template in DatabaseSetTemplate.objects.filter(sets__protocol__database__in=databases).distinct().order_by('name'):
(db_template, dataset) ='__')
if not(result.has_key(db_template)):
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