Esempio n. 1
0
    def get(request, searchid, forms):

        try:
            search = Search.objects.get(id=int(searchid))
        except:
            return HttpResponseNotFound()

        forms['search'] = forms['search2'] = SearchForm(instance=search)
        details = {}
        for result in SearchResult.objects.filter(search=search):

            site = result.site
            id = site.id, site.name, site.url
            content = attributes = ip = whois = None

            try:
                content = SIteContent.objects.filter(site=site ).latest('date')
            except:
                pass

            try:
                attributes = SiteAttributes.objects.filter(site=site ).latest('date')
            except:
                pass

            if attributes:
                ip = first(attributes.ip.all())
                whois = first(attributes.whois.all())

            details[id]= {
                'content_form': None, # SiteContentForm(instance=content if content else SIteContent(site=result.site)) ,
                'content': None, #  SiteContentReadOnlyForm(instance=content) if content else None ,
                'whois': None, #  WhoisReadOnlyForm(instance=whois) if whois else None,
                'ip': None, #  IpReadOnlyForm(instance=ip) if ip else None,
            }

        return {
            'forms': forms,
            'results': SearchResult.objects.filter(search=search).order_by('-fresh','sequence'),
            'categories': SiteCategory.objects.filter(active=True).order_by("id"),
            'details': details,
            }
Esempio n. 2
0
def get_site_details(siteid, update= False):
    site = Site.objects.get(id=int(siteid))

    content = attributes = ip = whois = None

    try:
        content = SIteContent.objects.filter(site=site ).latest('date')
    except:
        pass

    try:
        attributes = SiteAttributes.objects.filter(site=site ).latest('date')
    except:
        pass

    if update:
        attributes = update_site_details(site, attributes)

    if attributes:
        ip = first(attributes.ip.all())
        whois = first(attributes.whois.all())
    return site,content,whois,ip
Esempio n. 3
0
def get_site_details(siteid, update= False):
    site = SiteData.objects.get(id=int(siteid))

    content = attributes = ip = whois = None

    try:
        content = SIteContent.objects.filter(site=site.site ).latest('date')
    except:
        pass

    try:
        attributes = SiteAttributes.objects.filter(site=site.site ).latest('date')
    except:
        pass

    if update:
        attributes = update_site_details(site.site, attributes)

    if attributes:
        ip = first(attributes.ip.all())
        whois = first(attributes.whois.all())
    return site,content,whois,ip