Skip to content

Commit d30c6a3

Browse files
committed
Merge branch 'release/0.1.0'
2 parents 2389a6e + 143817c commit d30c6a3

File tree

12 files changed

+550
-0
lines changed

12 files changed

+550
-0
lines changed

.bumpversion.cfg

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[bumpversion]
2+
current_version = 0.1.0
3+
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-dev(?P<dev>\d+))?
4+
serialize =
5+
{major}.{minor}.{patch}-dev{dev}
6+
{major}.{minor}.{patch}
7+
8+
[bumpversion:file:README.rst]
9+
10+
[bumpversion:file:setup.py]
11+

.gitignore

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
.hypothesis/
50+
.pytest_cache/
51+
52+
# Translations
53+
*.mo
54+
*.pot
55+
56+
# Django stuff:
57+
*.log
58+
local_settings.py
59+
db.sqlite3
60+
61+
# Flask stuff:
62+
instance/
63+
.webassets-cache
64+
65+
# Scrapy stuff:
66+
.scrapy
67+
68+
# Sphinx documentation
69+
docs/_build/
70+
71+
# PyBuilder
72+
target/
73+
74+
# Jupyter Notebook
75+
.ipynb_checkpoints
76+
77+
# IPython
78+
profile_default/
79+
ipython_config.py
80+
81+
# pyenv
82+
.python-version
83+
84+
# celery beat schedule file
85+
celerybeat-schedule
86+
87+
# SageMath parsed files
88+
*.sage.py
89+
90+
# Environments
91+
.env
92+
.venv
93+
env/
94+
venv/
95+
ENV/
96+
env.bak/
97+
venv.bak/
98+
99+
# Spyder project settings
100+
.spyderproject
101+
.spyproject
102+
103+
# Rope project settings
104+
.ropeproject
105+
106+
# mkdocs documentation
107+
/site
108+
109+
# mypy
110+
.mypy_cache/
111+
.dmypy.json
112+
dmypy.json
113+
114+
# Pyre type checker
115+
.pyre/
116+
117+
# django project
118+
/db.sqlite3
119+
/manage.py
120+
/mysite/

CHANGELOG.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Revision History
2+
================
3+
4+
0.1.0 2018-11-20
5+
6+
- A collection of Django templatetags to flexibly incorporate links and breadcrumbs from app pages to the homepage of a project

LICENSE

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Copyright (c) 2018, Michael F. Covington
2+
All rights reserved.
3+
4+
Redistribution and use in source and binary forms, with or without
5+
modification, are permitted provided that the following conditions are met:
6+
7+
* Redistributions of source code must retain the above copyright notice, this
8+
list of conditions and the following disclaimer.
9+
10+
* Redistributions in binary form must reproduce the above copyright notice,
11+
this list of conditions and the following disclaimer in the documentation
12+
and/or other materials provided with the distribution.
13+
14+
* Neither the name of django-project-home-templatetags nor the names of its
15+
contributors may be used to endorse or promote products derived from
16+
this software without specific prior written permission.
17+
18+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

MANIFEST.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
include CHANGELOG.rst
2+
include LICENSE
3+
include README.rst
4+
recursive-include project_home_tags/templatetags *

README.rst

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
********************************
2+
django-project-home-templatetags
3+
********************************
4+
5+
``django-project-home-templatetags`` is a collection of Django templatetags to flexibly incorporate links and breadcrumbs from app pages to the homepage of a project.
6+
7+
If ``PROJECT_HOME_NAMESPACE`` is not defined to ``settings.py``, these template tags are silenced.
8+
9+
Source code is available on GitHub at `mfcovington/django-project-home-templatetags <https://github.com/mfcovington/django-project-home-templatetags>`_.
10+
11+
.. contents:: :local:
12+
13+
14+
Installation
15+
============
16+
17+
**PyPI**
18+
19+
.. code-block:: sh
20+
21+
pip install django-project-home-templatetags
22+
23+
24+
**GitHub (development branch)**
25+
26+
.. code-block:: sh
27+
28+
pip install git+http://github.com/mfcovington/django-project-home-templatetags.git@develop
29+
30+
31+
Configuration
32+
=============
33+
34+
Add ``project_home_tags`` to ``INSTALLED_APPS`` in ``settings.py``:
35+
36+
.. code-block:: python
37+
38+
INSTALLED_APPS = (
39+
...
40+
'project_home_tags',
41+
)
42+
43+
44+
Specify the ``PROJECT_HOME_NAMESPACE`` in ``settings.py``:
45+
46+
.. code-block:: python
47+
48+
PROJECT_HOME_NAMESPACE = 'project_name:index_view'
49+
50+
51+
By default, a link created with a ``project_home_tags`` template tag has 'Home' as its text. This can be overridden by defining an optional project-wide label with ``PROJECT_HOME_LABEL`` in ``settings.py``:
52+
53+
.. code-block:: python
54+
55+
PROJECT_HOME_LABEL = 'Homepage' # Optional; Default is 'Home'
56+
57+
58+
Both the default and the project-wide label can be overridden by passing a string to the template tag. For example:
59+
60+
.. code-block:: python
61+
62+
{% project_home_breadcrumb_bs4 'Custom Label' %}
63+
64+
65+
Template Tags
66+
=============
67+
68+
``{% load project_home %}``
69+
--------------------------------
70+
71+
Loads the project home template tags in your Django template.
72+
73+
74+
``{% project_home_url %}``
75+
--------------------------
76+
77+
A template tag to return the project's home URL.
78+
79+
.. code-block:: python
80+
81+
{% load project_home %}
82+
83+
<a href="{% project_home_url %}">Home</a>
84+
85+
86+
If ``settings.PROJECT_HOME_NAMESPACE`` is defined as ``'project_name:index_view'``, this is equivalent to:
87+
88+
.. code-block:: python
89+
90+
<a href="{% url 'project_name:index_view' %}">Home</a>
91+
92+
93+
``{% project_home_breadcrumb_bs3 %}``
94+
-------------------------------------
95+
96+
A template tag to return the project's home URL and label formatted as a `Bootstrap 3 breadcrumb <https://getbootstrap.com/docs/3.3/components/#breadcrumbs>`_.
97+
98+
.. code-block:: python
99+
100+
{% load project_home %}
101+
102+
<ol class="breadcrumb">
103+
{% project_home_breadcrumb_bs3 %} {# <--- #}
104+
<li><a href="{% url 'app:namespace' %}">List of Objects</a></li>
105+
<li class="active">Object Detail</li>
106+
</ol>
107+
108+
109+
If ``settings.PROJECT_HOME_NAMESPACE`` is defined as ``'project_name:index_view'``, this is equivalent to:
110+
111+
.. code-block:: python
112+
113+
<ol class="breadcrumb">
114+
<li><a href="{% url 'project_name:index_view' %}">Home</a></li> {# <--- #}
115+
<li><a href="{% url 'app:namespace' %}">List of Objects</a></li>
116+
<li class="active">Object Detail</li>
117+
</ol>
118+
119+
120+
``{% project_home_breadcrumb_bs4 %}``
121+
-------------------------------------
122+
123+
A template tag to return the project's home URL and label formatted as a `Bootstrap 4 breadcrumb <https://getbootstrap.com/docs/4.1/components/breadcrumb/>`_.
124+
125+
.. code-block:: python
126+
127+
{% load project_home %}
128+
129+
<ol class="breadcrumb">
130+
{% project_home_breadcrumb_bs4 %} {# <--- #}
131+
<li class="breadcrumb-item" aria-label="breadcrumb"><a href="{% url 'app:namespace' %}">List of Objects</a></li>
132+
<li class=" breadcrumb-item active" aria-label="breadcrumb" aria-current="page">Object Detail</li>
133+
</ol>
134+
135+
136+
If ``settings.PROJECT_HOME_NAMESPACE`` is defined as ``'project_name:index_view'``, this is equivalent to:
137+
138+
.. code-block:: python
139+
140+
<ol class="breadcrumb">
141+
<li class="breadcrumb-item" aria-label="breadcrumb"><a href="{% url 'project_name:index_view' %}">Home</a></li> {# <--- #}
142+
<li class="breadcrumb-item" aria-label="breadcrumb"><a href="{% url 'app:namespace' %}">List of Objects</a></li>
143+
<li class=" breadcrumb-item active" aria-label="breadcrumb" aria-current="page">Object Detail</li>
144+
</ol>
145+
146+
147+
*Version 0.1.0*

project_home_tags/__init__.py

Whitespace-only changes.

project_home_tags/apps.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
from django.apps import AppConfig
2+
3+
4+
class ProjectHomeTagsConfig(AppConfig):
5+
name = 'project_home_tags'

project_home_tags/templatetags/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)