Commit 57b6f452 by Szabolcs Gelencser

Implement proper template listing

parent b29365a5
...@@ -278,7 +278,11 @@ class TemplateList(LoginRequiredMixin, FilterMixin, SingleTableView): ...@@ -278,7 +278,11 @@ class TemplateList(LoginRequiredMixin, FilterMixin, SingleTableView):
return super(TemplateList, self).get(*args, **kwargs) return super(TemplateList, self).get(*args, **kwargs)
def get_queryset(self): def get_queryset(self):
return InstanceTemplate.objects.filter(owner_id=self.request.user.id) images = openstack_api.glance.image_list_detailed(self.request)[0] # TODO: why nested lists?
snapshot_ids = [
i.id for i in images if hasattr(i, 'image_location') and i.image_location == 'snapshot'
]
return InstanceTemplate.objects.filter(image_id__in=snapshot_ids)
class TemplateDelete(DeleteViewBase): class TemplateDelete(DeleteViewBase):
......
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 sign in to comment