Skip to content

arthanson/django-airports-xtd

Repository files navigation

django-airports-xtd

Django app providing transport hub data (airports, train stations, ferry terminals) from OpenFlights.

Documentation | PyPI | GitHub

Requirements

  • Python 3.10+
  • Django 5.0+
  • GeoDjango with PostGIS or Spatialite
  • django-cities-xtd >= 0.7.0

Installation

pip install django-airports-xtd

Add to your INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    "django.contrib.gis",
    "cities",
    "airports",
    ...
]

Configure the cities model settings:

CITIES_COUNTRY_MODEL = "cities.Country"
CITIES_CITY_MODEL = "cities.City"

Run migrations:

python manage.py migrate

Usage

Import data from OpenFlights:

# Import airports only (default)
python manage.py airports

# Import airports and train stations
python manage.py airports --stations

# Import airports and ferry terminals
python manage.py airports --ports

# Import all types
python manage.py airports --all

For detailed usage examples and spatial queries, see the documentation.

Models

Three models are provided, all with GeoDjango PointField support:

Model Description
Airport Airports and airfields
TrainStation Train stations with IATA codes
Port Ferry terminals with IATA codes

Common fields (shared via abstract base):

Field Description
id Django auto-generated primary key
openflights_id Unique identifier from OpenFlights database
name Hub name
iata 3-character IATA code (e.g., "JFK")
icao 4-character ICAO code (e.g., "KJFK")
altitude Altitude in meters
location GeoDjango PointField (SRID 4326)
country ForeignKey to cities.Country
city ForeignKey to cities.City
timezone IANA timezone (e.g., "America/New_York")
source Data source ("OurAirports", "Legacy", "User")

Compatibility

Python Django 5.0 Django 5.1 Django 5.2 Django 6.0
3.10 Yes Yes Yes -
3.11 Yes Yes Yes -
3.12 Yes Yes Yes -
3.13 - Yes Yes Yes
3.14 - - Yes Yes

Development

See the development documentation for setup instructions.

Quick Start

# Clone the repository
git clone https://github.com/arthanson/django-airports-xtd.git
cd django-airports-xtd

# Run tests
just test-quick

# Run linting
just lint

License

MIT License

Credits

About

It's like django-cities, but django-airports

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 5