Closed pwalsh closed 8 years ago
also as mentioned in the slack discussion, we need to
@kiote yes, just data migrations, not migrations for Models/Schemas
do cities have AlternativeName references? If yes, we'll need to provide lookups based on that data, and also include it in serialisers.
Every model: City, Country, etc have AlternativeName as ManyToMany connection, so we can use that as well (but AltNames are not imported yet).
So we possibly able to add to every detail endpoint this:
alt_names = ['name',...,'name']
For Postal Code model:
django-cities does not have a link to region there, just a string representation of region name and they could even not exist: https://github.com/coderholic/django-cities/blob/master/cities/models.py#L132
For now in our model I left it as it is, what would you suggest?
I'd suggest it be a foreign key to a region, which is part of our model.
okay, but what to do with non-existing and empty values? skip them?
sure, it means the field is nullable.
seems like this one is done?
Description
Next iteration on the API to expose more data, and refactor the model layer for adding additional data sources in near future.
Tasks
Model/Serialiser Refactor
django-cities
modelsCosmopolitanContinent
CosmopolitanCountry
CosmopolitanCurrency
CosmopolitanCity
CosmopolitanRegion
CosmopolitanPostCode
id
, so we expose a standard interface even though the "primary key" has various different names like "code" or "name" in our data sourcesNew endpoints
Cities
/api/v1/countries/
(/api/v1/cities/?countries={id}
,/api/v1/cities/?countries={id},{id},{id}
)id
- should be the ascii name?name
name_std
url
kind
country
(an object ofcode
andurl
)region
(an object ofcode
andurl
)/api/v1/cities/{id}
country
, being an object with the same serialiser as the country list objectregion
, being an object with the same serialiser as the region list objectRegions
/api/v1/regions/
(/api/v1/regions/?countries={id}
,/api/v1/regions/?countries={id},{id},{id}
)name
name_std
url
code
country
(an object ofcode
andurl
)/api/v1/regions/{id}
country
, being an object with the same serialiser as the country list objectcontinent
, being an object with the same serialiser as the region list objectPostcodes
/api/v1/postcodes/
(/api/v1/postcodes/?countries={id}
,/api/v1/postcodes/?countries={id},{id},{id}
)id
name_std
url
kind
country
(an object ofcode
andurl
)region
(an object ofcode
andurl
)/api/v1/postcodes/{id}
country
, being an object with the same serialiser as the country list objectregion
, being an object with the same serialiser as the region list object@kiote do cities have
AlternativeName
references? If yes, we'll need to provide lookups based on that data, and also include it in serialisers. Please advise.