Commit c01294f0 authored by Guilhem Saurel's avatar Guilhem Saurel
Browse files

docker view: can filter from GET parameters

parent cd67db25
Pipeline #552 passed with stages
in 56 seconds
......@@ -95,8 +95,8 @@ def json_doc(request):
def docker(request):
method = request.GET.get('method', 'build')
if method not in ['push', 'pull', 'build']:
method = 'build'
return HttpResponse('\n'.join([' '.join(getattr(image, method)()) for image in models.Image.objects.all()]),
content_type="text/plain")
cmd = 'build'
if 'cmd' in request.GET and request.GET['cmd'] in ['push', 'pull', 'build']:
cmd = request.GET.pop('cmd')
images = models.Image.objects.filter(**request.GET.dict())
return HttpResponse('\n'.join([' '.join(getattr(image, cmd)()) for image in images]), content_type="text/plain")
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