Commit a588c8f8 by Bence Dányi

firewall_gui: host listing added

parent abb28742
...@@ -50,3 +50,30 @@ def list_rules(request): ...@@ -50,3 +50,30 @@ def list_rules(request):
} for rule in Rule.objects.all()] } for rule in Rule.objects.all()]
return HttpResponse(json.dumps(rules), content_type="application/json") return HttpResponse(json.dumps(rules), content_type="application/json")
def list_hosts(request):
hosts = [{
"id": host.id,
"reverse": host.reverse,
"name": host.hostname,
"ipv4": host.ipv4,
"pub" : "foo", #ide kell valami!
"shared_ip": host.shared_ip,
"description": host.description,
"comment": host.comment,
"location": host.location,
"vlan": {
"name": host.vlan.name,
"id": host.vlan.id
},
"owner": {
"name": str(host.owner),
"id": host.owner.id
},
"created_at": host.created_at.isoformat(),
"modified_at": host.modified_at.isoformat(),
"groups": [{
"name": group.name,
"id": group.id,
} for group in host.groups.all()]
} for host in Host.objects.all()]
return HttpResponse(json.dumps(hosts), content_type="application/json")
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