Exemplo n.º 1
0
 def get_results(self, country, search):
     message, companies, total, pages = backends_loop(country, search)
     return {
         'search': search,
         'object_list': companies,
         'message': message,
         'total': total,
         'pages': pages,
         'error': False,  #cf.message,
     }
Exemplo n.º 2
0
 def get_results(self, search):
     message, companies, total, pages = backends_loop(
         self.kwargs.get('country', 'fr'), search)
     return {
         'search': search,
         'object_list': companies,
         'message': message,
         'total': total,
         'pages': pages,
         'error': False,  #cf.message,
         'results':
         _.results % total if int(total) > 1 else _.result % total,
         'strpages': _.pages % pages if int(pages) > 1 else _.page % pages,
         'toomuch': _.toomuch % total,
     }
Exemplo n.º 3
0
def AddressFrInit(sender, instance, **kwargs):
    if not instance.company.companyfr_address.count() or \
        not instance.company.companyfr_address.filter(nic=instance.nic).count():
        message, companies, total, pages = backends_loop('fr', instance.siren)
        if len(companies):
            company_bl = companies[0]
            addressfr, status = CompanyAddressFR.objects.get_or_create(
                company=instance.company,
                is_siege=company_bl['siege'],
                address=company_bl['address']['address'],
                complement=company_bl['address']['complement'],
                postal_code=company_bl['address']['postal_code'],
                locality=company_bl['address']['locality'],
                country=company_bl['address']['country'],
                country_code=company_bl['address']['country_code'],
                nic=company_bl['address']['nic']
            )
            addressfr.save()