0001-api_entreprise-fix-normalize_dates-function-39541.patch
passerelle/apps/api_entreprise/models.py | ||
---|---|---|
43 | 43 |
if isinstance(data[key], dict): |
44 | 44 |
normalize_dates(data[key]) |
45 | 45 |
if isinstance(data[key], list): |
46 |
for item in data[key]: |
|
47 |
normalize_dates(item) |
|
46 |
if data[key] and isinstance(data[key][0], str): |
|
47 |
# keep only the first value |
|
48 |
data[key] = data[key][0] |
|
49 |
else: |
|
50 |
for item in data[key]: |
|
51 |
if isinstance(item, dict): |
|
52 |
normalize_dates(item) |
|
48 | 53 | |
49 | 54 |
if key.startswith('date') and not key.endswith('timestamp'): |
50 | 55 |
if isinstance(data[key], int): |
tests/test_api_entreprise.py | ||
---|---|---|
192 | 192 |
"type_voie": "RUE", |
193 | 193 |
"libelle_voie": "Lebouis", |
194 | 194 |
"code_insee": "75120", |
195 |
"code_postal": "75014",
|
|
195 |
"code_postal": ["75014"],
|
|
196 | 196 |
"commune": "Paris" |
197 | 197 |
}, |
198 | 198 |
"groupement": "Simple", |
199 |
- |