django-nine¶
django-nine - version checking library for Django.
Prerequisites¶
- Python 2.6, 2.7, 3.4, 3.5, 3.6 and 3.7.
- Django 1.5, 1.6, 1.7, 1.8, 1.9, 1.10, 1.11, 2.0, 2.1 and 2.2.
Installation¶
Install latest stable version from PyPI:
pip install django-nine
Or latest stable version from GitHub:
pip install https://github.com/barseghyanartur/django-nine/archive/stable.zip
Or latest stable version from BitBucket:
pip install https://bitbucket.org/barseghyanartur/django-nine/get/stable.zip
Usage¶
Get Django versions¶
In code¶
For example, if Django version installed in your environment is 1.7.4, then the following would be true.
from django_nine import versions
versions.DJANGO_1_7 # True
versions.DJANGO_LTE_1_7 # True
versions.DJANGO_GTE_1_7 # True
versions.DJANGO_GTE_1_8 # False
versions.DJANGO_GTE_1_4 # True
versions.DJANGO_LTE_1_6 # False
In templates¶
With use of context processors¶
Add nine.context_processors.versions
to your context processors.
TEMPLATES[0]['OPTIONS']['context_processors'] += \
['django_nine.context_processors.versions']
Or if you are using an old version of Django:
TEMPLATE_CONTEXT_PROCESSORS += ['django_nine.context_processors.versions']
Testing¶
Simply type:
./runtests.py
Or use tox:
tox
Or use tox to check specific env:
tox -e py37
Or run Django tests:
./manage.py test nine --settings=settings.testing
License¶
GPL-2.0-only OR LGPL-2.1-or-later
Author¶
Artur Barseghyan <artur.barseghyan@gmail.com>