def get_context_data(self, **kwargs): context = super(CoreDetailView, self).get_context_data(**kwargs) ctnr = kwargs.get('object', False) if not ctnr: return context users = ctnr.users.all() user_headers, user_matrix, user_urls = tablefy_users(users) domains = ctnr.domains.filter(is_reverse=False) domain_headers, domain_matrix, domain_urls = tablefy(domains) rdomains = ctnr.domains.filter(is_reverse=True) rdomain_headers, rdomain_matrix, rdomain_urls = tablefy(rdomains) return dict({ "user_headers": user_headers, "user_matrix": user_matrix, "user_urls": user_urls, "domain_headers": domain_headers, "domain_matrix": domain_matrix, "domain_urls": domain_urls, "rdomain_headers": rdomain_headers, "rdomain_matrix": rdomain_matrix, "rdomain_urls": rdomain_urls, }.items() + context.items())
def get_context_data(self, **kwargs): context = super(CoreDetailView, self).get_context_data(**kwargs) ctnr = kwargs.get('object', False) if not ctnr: return context users = ctnr.users.all() user_headers, user_matrix, user_urls = tablefy_users(users) domains = ctnr.domains.all() domain_headers, domain_matrix, domain_urls = tablefy(domains) rdomains = ctnr.reverse_domains.all() rdomain_headers, rdomain_matrix, rdomain_urls = tablefy(rdomains) return dict({ "user_headers": user_headers, "user_matrix": user_matrix, "user_urls": user_urls, "domain_headers": domain_headers, "domain_matrix": domain_matrix, "domain_urls": domain_urls, "rdomain_headers": rdomain_headers, "rdomain_matrix": rdomain_matrix, "rdomain_urls": rdomain_urls, }.items() + context.items())
def get_context_data(self, **kwargs): context = super(DetailView, self).get_context_data(**kwargs) domain = kwargs.get('object', False) if not domain: return context # TODO this process can be generalized. It's not very high priority. address_objects = domain.addressrecord_set.all().order_by('label') adr_headers, adr_matrix, adr_urls = tablefy(address_objects) mx_objects = domain.mx_set.all().order_by('label') mx_headers, mx_matrix, mx_urls = tablefy(mx_objects) srv_objects = domain.srv_set.all().order_by('label') srv_headers, srv_matrix, srv_urls = tablefy(srv_objects) txt_objects = domain.txt_set.all().order_by('label') txt_headers, txt_matrix, txt_urls = tablefy(txt_objects) cname_objects = domain.cname_set.all().order_by('label') cname_headers, cname_matrix, cname_urls = tablefy(cname_objects) ptr_objects = domain.ptr_set.all().order_by('ip_str') ptr_headers, ptr_matrix, ptr_urls = tablefy(ptr_objects) ns_objects = domain.nameserver_set.all().order_by('server') ns_headers, ns_matrix, ns_urls = tablefy(ns_objects) # Join the two dicts context = dict({ "ns_headers": ns_headers, "ns_matrix": ns_matrix, "ns_urls": ns_urls, "address_headers": adr_headers, "address_matrix": adr_matrix, "address_urls": adr_urls, "mx_headers": mx_headers, "mx_matrix": mx_matrix, "mx_urls": mx_urls, "srv_headers": srv_headers, "srv_matrix": srv_matrix, "srv_urls": srv_urls, "txt_headers": txt_headers, "txt_matrix": txt_matrix, "txt_urls": txt_urls, "cname_headers": cname_headers, "cname_matrix": cname_matrix, "cname_urls": cname_urls, "ptr_headers": ptr_headers, "ptr_matrix": ptr_matrix, "ptr_urls": ptr_urls }.items() + context.items()) return context
def get_context_data(self, **kwargs): context = super(SOADetailView, self).get_context_data(**kwargs) soa = kwargs.get('object', False) if not soa: return soa dom_objects = soa.domain_set.all() dom_headers, dom_matrix, dom_urls = tablefy(dom_objects) rdom_objects = soa.reversedomain_set.all() rdom_headers, rdom_matrix, rdom_urls = tablefy(rdom_objects) context = dict({ "dom_headers": dom_headers, "dom_matrix": dom_matrix, "dom_urls": dom_urls, "rdom_headers": rdom_headers, "rdom_matrix": rdom_matrix, "rdom_urls": rdom_urls, }.items() + context.items()) return context
def get_context_data(self, **kwargs): context = super(SOADetailView, self).get_context_data(**kwargs) soa = kwargs.get('object', False) if not soa: return soa dom_objects = soa.domain_set.all().order_by( 'master_domain').select_related() dom_headers, dom_matrix, dom_urls = tablefy(dom_objects) context = dict({ "dom_headers": dom_headers, "dom_matrix": dom_matrix, "dom_urls": dom_urls, }.items() + context.items()) return context
def get_context_data(self, **kwargs): context = super(SOADetailView, self).get_context_data(**kwargs) soa = kwargs.get('object', False) if not soa: return soa dom_objects = soa.domain_set.all().order_by('master_domain' ).select_related() dom_headers, dom_matrix, dom_urls = tablefy(dom_objects) context = dict({ "dom_headers": dom_headers, "dom_matrix": dom_matrix, "dom_urls": dom_urls, }.items() + context.items()) return context
def get_context_data(self, **kwargs): context = super(ReverseDomainDetailView, self).get_context_data( **kwargs) reverse_domain = kwargs.get('object', False) if not reverse_domain: return context # TODO this process can be generalized. It's not very high priority. revns_objects = ReverseNameserver.objects.filter( reverse_domain=reverse_domain) revns_headers, revns_matrix, revns_urls = tablefy(revns_objects) # Join the two dicts context = dict({ "revns_headers": revns_headers, "revns_matrix": revns_matrix, "revns_urls": revns_urls, }.items() + context.items()) return context
def get_context_data(self, **kwargs): context = super(DetailView, self).get_context_data(**kwargs) domain = kwargs.get('object', False) if not domain: return context # TODO this process can be generalized. Not very high priority. mx_objects = domain.mx_set.all().order_by('label') mx_headers, mx_matrix, mx_urls = tablefy(mx_objects) srv_objects = domain.srv_set.all().order_by('label') srv_headers, srv_matrix, srv_urls = tablefy(srv_objects) txt_objects = domain.txt_set.all().order_by('label') txt_headers, txt_matrix, txt_urls = tablefy(txt_objects) sshfp_objects = domain.sshfp_set.all().order_by('label') sshfp_headers, sshfp_matrix, sshfp_urls = tablefy(sshfp_objects) cname_objects = domain.cname_set.order_by('label') if cname_objects.count() > 50: cname_views = False else: cname_views = True cname_headers, cname_matrix, cname_urls = tablefy(cname_objects, cname_views) # TODO, include Static Registrations ptr_objects = domain.ptr_set.all().order_by('ip_str') ptr_headers, ptr_matrix, ptr_urls = tablefy(ptr_objects) # TODO, include Static Registrations all_static_intr = StaticInterface.objects.all() intr_objects = domain.staticinterface_set.all().order_by( 'name').order_by('ip_str') intr_headers, intr_matrix, intr_urls = tablefy(intr_objects) address_objects = domain.addressrecord_set.all().order_by('label') # Takes too long to load more than 50. if address_objects.count() > 50: adr_views = False else: adr_views = True adr_headers, adr_matrix, adr_urls = tablefy(address_objects, adr_views) ns_objects = domain.nameserver_set.all().order_by('server') ns_headers, ns_matrix, ns_urls = tablefy(ns_objects) # Join the two dicts context = dict({ "ns_headers": ns_headers, "ns_matrix": ns_matrix, "ns_urls": ns_urls, "address_headers": adr_headers, "address_matrix": adr_matrix, "address_urls": adr_urls, "address_views": adr_views, "mx_headers": mx_headers, "mx_matrix": mx_matrix, "mx_urls": mx_urls, "srv_headers": srv_headers, "srv_matrix": srv_matrix, "srv_urls": srv_urls, "txt_headers": txt_headers, "txt_matrix": txt_matrix, "txt_urls": txt_urls, "sshfp_headers": sshfp_headers, "sshfp_matrix": sshfp_matrix, "sshfp_urls": sshfp_urls, "cname_headers": cname_headers, "cname_matrix": cname_matrix, "cname_urls": cname_urls, "cname_views": cname_views, "ptr_headers": ptr_headers, "ptr_matrix": ptr_matrix, "ptr_urls": ptr_urls, "intr_headers": intr_headers, "intr_matrix": intr_matrix, "intr_urls": intr_urls }.items() + context.items()) return context
else: error = True if error: # Revert domain if not valid. prune_tree(domain) return_form = FQDNFormKlass(orig_qd) return_form._errors = form._errors form = return_form object_list = make_paginator(request, Klass.objects.all(), 50) return render(request, 'cydns/cydns_record_view.html', { 'form': form, 'obj': record, 'object_list': object_list, 'object_table': tablefy(object_list), 'domains': domains, 'record_type': record_type, 'pk': pk, }) def cydns_get_record(request): """ Update view called asynchronously from the list_create view """ record_type = request.GET.get('record_type', '') record_pk = request.GET.get('pk', '') if not (record_type and record_pk): raise Http404
def get_context_data(self, **kwargs): context = super(DetailView, self).get_context_data(**kwargs) domain = kwargs.get('object', False) if not domain: return context # TODO this process can be generalized. Not very high priority. mx_objects = domain.mx_set.all().order_by('label') mx_headers, mx_matrix, mx_urls = tablefy(mx_objects) srv_objects = domain.srv_set.all().order_by('label') srv_headers, srv_matrix, srv_urls = tablefy(srv_objects) txt_objects = domain.txt_set.all().order_by('label') txt_headers, txt_matrix, txt_urls = tablefy(txt_objects) sshfp_objects = domain.sshfp_set.all().order_by('label') sshfp_headers, sshfp_matrix, sshfp_urls = tablefy(sshfp_objects) cname_objects = domain.cname_set.order_by('label') if cname_objects.count() > 50: cname_views = False else: cname_views = True cname_headers, cname_matrix, cname_urls = tablefy( cname_objects, cname_views) # TODO, include Static Registrations ptr_objects = domain.ptr_set.all().order_by('ip_str') ptr_headers, ptr_matrix, ptr_urls = tablefy(ptr_objects) # TODO, include Static Registrations all_static_intr = StaticInterface.objects.all() intr_objects = domain.staticinterface_set.all().order_by( 'name').order_by('ip_str') intr_headers, intr_matrix, intr_urls = tablefy(intr_objects) address_objects = domain.addressrecord_set.all().order_by('label') # Takes too long to load more than 50. if address_objects.count() > 50: adr_views = False else: adr_views = True adr_headers, adr_matrix, adr_urls = tablefy(address_objects, adr_views) ns_objects = domain.nameserver_set.all().order_by('server') ns_headers, ns_matrix, ns_urls = tablefy(ns_objects) # Join the two dicts context = dict({ "ns_headers": ns_headers, "ns_matrix": ns_matrix, "ns_urls": ns_urls, "address_headers": adr_headers, "address_matrix": adr_matrix, "address_urls": adr_urls, "address_views": adr_views, "mx_headers": mx_headers, "mx_matrix": mx_matrix, "mx_urls": mx_urls, "srv_headers": srv_headers, "srv_matrix": srv_matrix, "srv_urls": srv_urls, "txt_headers": txt_headers, "txt_matrix": txt_matrix, "txt_urls": txt_urls, "sshfp_headers": sshfp_headers, "sshfp_matrix": sshfp_matrix, "sshfp_urls": sshfp_urls, "cname_headers": cname_headers, "cname_matrix": cname_matrix, "cname_urls": cname_urls, "cname_views": cname_views, "ptr_headers": ptr_headers, "ptr_matrix": ptr_matrix, "ptr_urls": ptr_urls, "intr_headers": intr_headers, "intr_matrix": intr_matrix, "intr_urls": intr_urls }.items() + context.items()) return context
error = True if error: # Revert domain if not valid. prune_tree(domain) return_form = FQDNFormKlass(orig_qd) return_form._errors = form._errors form = return_form object_list = make_paginator(request, Klass.objects.all(), 50) return render( request, 'cydns/cydns_record_view.html', { 'form': form, 'obj': record, 'object_list': object_list, 'object_table': tablefy(object_list), 'domains': domains, 'record_type': record_type, 'pk': pk, }) def cydns_get_record(request): """ Update view called asynchronously from the list_create view """ record_type = request.GET.get('record_type', '') record_pk = request.GET.get('pk', '') if not (record_type and record_pk): raise Http404