use urljoin to create fallback country data URL (#50585)
This commit is contained in:
parent
828075ae23
commit
22de4ad1f1
|
@ -16,6 +16,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import time
|
||||
from urllib.parse import urljoin
|
||||
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
|
@ -112,7 +113,7 @@ class CountryWidget(forms.Select):
|
|||
country_url = settings.IMIO_COUNTRY_URL
|
||||
else:
|
||||
passerelle_url = list(settings.KNOWN_SERVICES['passerelle'].values())[0]['url']
|
||||
country_url = '%s/csvdatasource/pays/data' % passerelle_url
|
||||
country_url = urljoin(passerelle_url, '/csvdatasource/pays/data')
|
||||
try:
|
||||
self.choices = [(x['id'], x['text']) for x in requests.get(country_url).json()['data']]
|
||||
except ValueError:
|
||||
|
|
Loading…
Reference in New Issue