Skip to content

Commit

Permalink
prepare 0.1.13
Browse files Browse the repository at this point in the history
  • Loading branch information
barseghyanartur committed May 16, 2017
1 parent 8dba3bc commit e219000
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ are used for versioning (schema follows below):
0.3.2 to 0.4).
- All backwards incompatible changes are mentioned in this document.

0.1.13
------
2017-05-16

- Added context processor using versions in templates.

0.1.12
------
2017-02-09
Expand Down
23 changes: 23 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ Or latest stable version from BitBucket:
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.

Expand All @@ -44,6 +48,25 @@ the following would be true.
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.

.. code-block:: python
TEMPLATES[0]['OPTIONS']['context_processors'] += \
['nine.context_processors.versions']
Or if you are using an old version of Django:

.. code-block:: python
TEMPLATE_CONTEXT_PROCESSORS += ['nine.context_processors.versions']
Import User model
-----------------
Or you could safely import the user model as follows:

.. code-block:: python
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
except:
readme = ''

version = '0.1.12'
version = '0.1.13'

install_requires = [
#'Django',
Expand Down
4 changes: 2 additions & 2 deletions src/nine/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
__title__ = 'django-nine'
__version__ = '0.1.12'
__build__ = 0x00000d
__version__ = '0.1.13'
__build__ = 0x00000e
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
__copyright__ = '2015-2017 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
18 changes: 18 additions & 0 deletions src/nine/context_processors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from nine import versions as nine_versions

__title__ = 'nine.versions'
__author__ = 'Artur Barseghyan <artur.barseghyan@gmail.com>'
__copyright__ = 'Copyright (c) 2015-2017 Artur Barseghyan'
__license__ = 'GPL 2.0/LGPL 2.1'
__all__ = [
'versions',
]


def versions(request):
"""Get active theme.
:param django.http.HttpRequest request:
:return dict:
"""
return {'VERSIONS': nine_versions}

0 comments on commit e219000

Please sign in to comment.