``, etc) -- otherwise an exception will be raised.
57 |
58 | Installation
59 | ============
60 |
61 | Python 2.7+, 3.4+ are supported.
62 |
63 | 1. Install the *stable* version using ``pip``::
64 |
65 | pip install django-activeurl
66 |
67 | or install the *in-development* version using ``pip``::
68 |
69 | pip install -e git+git://github.com/hellysmile/django-activeurl#egg=django_activeurl
70 |
71 |
72 | 2. In your ``settings.py`` add the following:
73 |
74 | .. code-block:: python
75 |
76 | INSTALLED_APPS = (
77 | ...
78 | 'django_activeurl',
79 | ...
80 | )
81 |
82 | TEMPLATE_CONTEXT_PROCESSORS = (
83 | ...
84 | 'django.core.context_processors.request',
85 | ...
86 | )
87 |
88 | 3. The *lxml* library is required and thus additional libraries need to be installed to build it:
89 |
90 | * Ubuntu::
91 |
92 | sudo apt-get install libxml2 libxml2-dev libxslt-dev build-essential python-dev
93 | sudo ldconfig
94 |
95 | * Fedora::
96 |
97 | sudo yum groupinstall 'Development Tools'
98 | sudo yum install libxslt-devel libxml2 libxml2-devel python-devel
99 | sudo ldconfig
100 |
101 | * MacOS X::
102 |
103 | brew install libxml2 libxslt
104 | sudo update_dyld_shared_cache -force
105 |
106 | * Windows:
107 | A pre-built *lxml* binary can be found `here
`_
108 |
109 | * Clouds:
110 | There's a 99.99% chance that *lxml* will build out of the box.
111 |
112 | Options
113 | =======
114 |
115 | menu ="yes|no" (default: "yes")
116 | -------------------------------
117 |
118 | Should hierarchical menus be supported? There are two different ways to declare an *active* status:
119 |
120 | * the *starts-with* logic toggles the active state if ``request.get_full_path()`` starts with the
121 | contents of the ``
132 |
142 |
143 | {% endactiveurl %}
144 |
145 | The **equals** logic works best for non-hierarchical menus where only those items should be highlighted whose ``href``-attribute perfectly match ``request.get_full_path()``:
146 |
147 | .. code-block:: html+django
148 |
149 | {% activeurl menu="no" parent_tag="div" %}
150 |