Commit 14348bfb by Bence Dányi

firewall_gui: create new domain

parent 73000026
...@@ -524,8 +524,9 @@ def show_record(request, id=None): ...@@ -524,8 +524,9 @@ def show_record(request, id=None):
} }
return HttpResponse(json.dumps(record), content_type='application/json') return HttpResponse(json.dumps(record), content_type='application/json')
def show_domain(request, id): def show_domain(request, id=None):
domain = get_object_or_404(Domain, id=id) try:
domain = Domain.objects.get(id=id)
domain = { domain = {
'id': domain.id, 'id': domain.id,
'name': domain.name, 'name': domain.name,
...@@ -538,6 +539,18 @@ def show_domain(request, id): ...@@ -538,6 +539,18 @@ def show_domain(request, id):
'ttl': domain.ttl, 'ttl': domain.ttl,
'description': domain.description 'description': domain.description
} }
except:
domain = {
'id': None,
'name': None,
'owner': {
'name': None,
},
'created_at': None,
'modified_at': None,
'ttl': None,
'description': ''
}
return HttpResponse(json.dumps(domain), content_type='application/json') return HttpResponse(json.dumps(domain), content_type='application/json')
def make_autocomplete(entity, name='name'): def make_autocomplete(entity, name='name'):
......
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