Exemple #1
0
    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
Exemple #2
0
    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.
        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)

        ptr_objects = domain.ptr_set.all().order_by('ip_str')
        ptr_headers, ptr_matrix, ptr_urls = tablefy(ptr_objects)

        sreg_objects = domain.staticreg_set.all().order_by('name').order_by(
            'ip_str')
        sreg_headers, sreg_matrix, sreg_urls = tablefy(sreg_objects)

        address_objects = domain.addressrecord_set.all().order_by('label')
        # This 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)

        domain_objects = domain.domain_set.all().order_by('name')
        domain_headers, domain_matrix, domain_urls = tablefy(domain_objects)

        # Join the two dicts
        context = dict({
            "ns_headers": ns_headers,
            "ns_matrix": ns_matrix,
            "ns_urls": ns_urls,
            "domain_headers": domain_headers,
            "domain_matrix": domain_matrix,
            "domain_urls": domain_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,
            "sreg_headers": sreg_headers,
            "sreg_matrix": sreg_matrix,
            "sreg_urls": sreg_urls
        }.items() + context.items())

        return context
Exemple #3
0
    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.
        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)

        ptr_objects = domain.ptr_set.all().order_by('ip_str')
        ptr_headers, ptr_matrix, ptr_urls = tablefy(ptr_objects)

        sreg_objects = domain.staticreg_set.all().order_by(
            'name').order_by('ip_str')
        sreg_headers, sreg_matrix, sreg_urls = tablefy(sreg_objects)

        address_objects = domain.addressrecord_set.all().order_by('label')
        # This 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)

        domain_objects = domain.domain_set.all().order_by('name')
        domain_headers, domain_matrix, domain_urls = tablefy(domain_objects)

        # Join the two dicts
        context = dict({
            "ns_headers": ns_headers,
            "ns_matrix": ns_matrix,
            "ns_urls": ns_urls,

            "domain_headers": domain_headers,
            "domain_matrix": domain_matrix,
            "domain_urls": domain_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,

            "sreg_headers": sreg_headers,
            "sreg_matrix": sreg_matrix,
            "sreg_urls": sreg_urls
        }.items() + context.items())

        return context