Skip to content

Commit 8159206

Browse files
committed
Merge branch 'release/0.2.0'
2 parents d30c6a3 + 9c81aac commit 8159206

File tree

5 files changed

+19
-4
lines changed

5 files changed

+19
-4
lines changed

.bumpversion.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[bumpversion]
2-
current_version = 0.1.0
2+
current_version = 0.2.0
33
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)(\-dev(?P<dev>\d+))?
44
serialize =
55
{major}.{minor}.{patch}-dev{dev}

CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
Revision History
22
================
33

4+
0.2.0 2018-12-08
5+
6+
- Allow `settings.PROJECT_HOME_NAMESPACE` to be an actual URL, rather than just an internal namespace
7+
8+
49
0.1.0 2018-11-20
510

611
- A collection of Django templatetags to flexibly incorporate links and breadcrumbs from app pages to the homepage of a project

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,4 @@ If ``settings.PROJECT_HOME_NAMESPACE`` is defined as ``'project_name:index_view'
144144
</ol>
145145
146146
147-
*Version 0.1.0*
147+
*Version 0.2.0*

project_home_tags/templatetags/project_home.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from django import template
44
from django import VERSION as DJANGO_VERSION
55
from django.conf import settings
6+
from django.core.exceptions import ValidationError
7+
from django.core.validators import URLValidator
68
from django.utils.html import format_html
79

810
if DJANGO_VERSION < (1, 10):
@@ -20,10 +22,18 @@ def home_url():
2022
2123
Returns None if PROJECT_HOME_NAMESPACE is not defined in settings.
2224
"""
25+
global home_namespace
2326
try:
2427
return reverse(home_namespace)
2528
except Exception:
26-
return None
29+
try:
30+
validate_url = URLValidator()
31+
if '://' not in home_namespace:
32+
home_namespace = 'http://' + home_namespace
33+
validate_url(home_namespace)
34+
return(home_namespace)
35+
except ValidationError:
36+
return None
2737

2838

2939
def silence_without_namespace(f):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def read(*paths):
2424

2525
setup(
2626
name='django-project-home-templatetags',
27-
version='0.1.0',
27+
version='0.2.0',
2828
packages=['project_home_tags'],
2929
include_package_data=True,
3030
license='BSD License',

0 commit comments

Comments
 (0)