Metro models for Django (only for 1.7+), plus the parser that fills models with actual data from various data providers (primary - Wikipedia). This is renamed django-russian-metro package (!).
All russian and cis parsers (like kiev or minsk) respects locale, that's why for en locale they returns transliterated version of names. Parsers for other cities takes only english names.
Parser downloads the following data:
- MetroLine: number, color and title
- Metro: line binding, title
Also you can run django command sometimes to get always actual data, or use celery task load_metro.
-
For install django-metro, run on terminal:
$ pip install django-metro
-
Then add this app to
INSTALLED_APPS
:INSTALLED_APPS = ( ... 'metro', ... )
-
Apply migrations:
./manage.py migrate
-
Choose and specify data provider in
settings.py
:METRO_PROVIDER = 'moscow'
-
Finally, fill models with data:
./manage.py load_metro
-
Or:
from metro.parser import provider provider.download_all()
-
Or use celery task
load_metro
(shared task intasks.py
)
Assign METRO_PROVIDER
(in settings.py) one of the values below (source indicated in brackets):
'moscow'
-- Moscow (Wiki)'spb'
-- Saint Petersburg (Wiki)'novgorod'
-- Nizhny Novgorod (Wiki)'novosib'
-- Novosibirsk (Wiki)'ekat'
-- Yekaterinburg (Wiki/self)'kazan'
-- Kazan (Wiki)'samara'
-- Samara (Wiki)'omsk'
-- Omsk (self) :)
'kiev'
-- Kiev (Wiki)'minsk'
-- Minsk (Wiki)
'tokyo'
-- Tokyo (Wiki)'london'
-- London (Wiki), very basic (without zones and branches)
You can rename application title with METRO_APP_TITLE
in your settings.py
:
METRO_APP_TITLE = u'Saint Petersrburg Metro'
Adopted for django-suit (SortableStackedInline).
MIT probably.