Liege : Some modifications to use new service (with commissariat,...)
This commit is contained in:
parent
548b4b687d
commit
1afb7647e9
|
@ -29,6 +29,7 @@ from passerelle.utils.api import endpoint
|
|||
class ImioLiegeLisrue(BaseResource):
|
||||
PROFILE_CHOICES = (
|
||||
('LIEGE','Liege'),
|
||||
('LIEGE_BETA','Liege lisrue2 beta'),
|
||||
('NAMUR','Namur'),
|
||||
)
|
||||
service_url = models.CharField(max_length=128, blank=False,
|
||||
|
@ -44,7 +45,6 @@ class ImioLiegeLisrue(BaseResource):
|
|||
verbose_name=_('Check HTTPS Certificate validity'))
|
||||
|
||||
category = _('Geographic information system')
|
||||
|
||||
class Meta:
|
||||
verbose_name = _('Liege Lisrue Service')
|
||||
|
||||
|
@ -66,7 +66,10 @@ class ImioLiegeLisrue(BaseResource):
|
|||
if self.include_all_of_belgium:
|
||||
url += 'jsonlisrue/'
|
||||
else:
|
||||
url += 'jsonlisrue2/'
|
||||
if self.profile == 'LIEGE_BETA':
|
||||
url += 'jsonlgrue2com/'
|
||||
else:
|
||||
url += 'jsonlisrue2/'
|
||||
|
||||
if q:
|
||||
q = unicodedata.normalize('NFKD', request.GET['q']).encode('ascii', 'ignore')
|
||||
|
@ -101,7 +104,17 @@ class ImioLiegeLisrue(BaseResource):
|
|||
street_label = u"{} - {}".format(street_label, str(item.get('codePostal'))).strip()
|
||||
else:
|
||||
street_label = street_label.strip()
|
||||
streets.append({
|
||||
|
||||
if (self.profile == 'LIEGE_BETA'):
|
||||
if item.get('statutVO') is not None and item.get('statutVO').get('code') == '1':
|
||||
streets.append({
|
||||
'id': item.get('codeRue'),
|
||||
'text': street_label,
|
||||
'codeCommissariat': item.get('commissariat').get('codeCommissariat') if item.get('commissariat') else '',
|
||||
'libelleCommissariat': item.get('commissariat').get('libelleCommissariat') if item.get('commissariat') else ''
|
||||
})
|
||||
else:
|
||||
streets.append({
|
||||
'id': item.get('codeRue'),
|
||||
'text': street_label,
|
||||
})
|
||||
|
|
Loading…
Reference in New Issue