Countries
Administrative endpoints for countries — the country records used as the geographic reference for addresses, cities, townships, and retail stores.
A country consists of a display name, a unique country code, an active/inactive status, and optional multilingual translations of the name.
Core Capabilities
1. Country Listing & Filtering
Retrieve a paginated list of all countries (active and inactive), ordered by name ascending.
Filter by
name(case-insensitive contains),code(case-insensitive exact), or the active status of associated retail stores.Order results with the
sortparameter.
2. Country Lifecycle Management
Create a country with a unique code and display name.
Fully or partially update an existing country.
Deactivate a country (soft delete — sets
is_activetofalse; the record is not removed).
3. Multilingual Names
Store translated names under the
translationsfield, keyed by language code.
Country Fields
pk
integer
The unique identifier of the country. Assigned by the server; read-only.
is_active
boolean
Whether the country is active. Inactive countries are excluded from storefront address lookups.
name
string
The display name of the country. Required on create and full update.
code
string (max 3 chars)
The unique country code (e.g. TR, US). Required on create and full update. Must be unique across all countries (case-sensitive).
translations
object or null
A mapping of language codes to translated field values. Example: {"tr": {"name": "Türkiye"}, "en": {"name": "Turkey"}}. Optional; defaults to {}.
Filtering & Ordering
name
Case-insensitive contains
?name=turkey matches Turkey, ?name=urk also matches Turkey.
code
Exact, case-insensitive
?code=tr and ?code=TR return the same record.
retailstore__is_active
Boolean
Filters to countries that have at least one retail store whose is_active matches this value.
Results are ordered by name ascending by default. Use the sort query parameter to change the order on pk, name, code, or is_active; prefix with - for descending (e.g. ?sort=-pk).
Soft Delete
Calling DELETE /countries/{id}/ does not remove the record from the database. It sets is_active to false, which hides the country from storefront address forms. The record can be reactivated at any time with PATCH /countries/{id}/ sending {"is_active": true}.
Dynamic Settings & Environment Variables
No dynamic settings (dj_dynamic_settings) are read directly by the country endpoints. Listing, create, update, and deactivate operations behave identically regardless of management panel configuration.
The DEFAULT_COUNTRY_CODE dynamic setting — registered in omnishop/address/settings/conf.py — identifies which country is used as the default in address forms and checkout flows, but it is consumed by the address and checkout services, not by these administrative endpoints.
Environment variables: No environment variables are read directly by these endpoints.
Last updated
Was this helpful?

