Skip to content

Commit

Permalink
Merge pull request #3 from emencia/context_templatag
Browse files Browse the repository at this point in the history
Merge 0.1.5 into dev
  • Loading branch information
sam-b0t authored May 30, 2024
2 parents 70eb619 + ce37d69 commit c83d1cf
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 15 deletions.
15 changes: 15 additions & 0 deletions docs/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@
History
=======

0.1.5 (2024-05-30)
------------------

Changes
~~~~~~~
* [CHG] Added global context accessibility in template tags (Ticket #5289453) [Samy Saad]


Other
~~~~~
* [CHG] Removed dj4.0 and dj4.1 from tox tests [Samy Saad]
* [FIX] Added default autofield in settings [Samy Saad]
* [FIX] Fixed rtd build [Samy Saad]
* [DOC] Updated doc [Samy Saad]

0.1.4 (2023-09-21)
------------------

Expand Down
8 changes: 2 additions & 6 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
;;
[metadata]
name = django-firm-info
version = 0.1.4
version = 0.1.5
description = A Django application package for storage firm info
long_description = file:README.rst
long_description_content_type = text/x-rst
Expand All @@ -29,8 +29,6 @@ classifiers =
Programming Language :: Python :: 3.10
Framework :: Django
Framework :: Django :: 3.2
Framework :: Django :: 4.0
Framework :: Django :: 4.1
Framework :: Django :: 4.2
Intended Audience :: Developers
Topic :: Internet :: WWW/HTTP
Expand Down Expand Up @@ -95,7 +93,7 @@ testpaths =

[tox:tox]
minversion = 3.4.0
envlist = py{38,39,310}-django{32,40,41,42}
envlist = py{38,39,310}-django{32,42}

[gh-actions]
python =
Expand All @@ -107,8 +105,6 @@ python =

deps =
django32: Django>=3.2,<4.0
django40: Django>=4.0,<4.1
django41: Django>=4.1,<4.2
django42: Django>=4.2,<5.0
py38-django32: backports.zoneinfo

Expand Down
18 changes: 9 additions & 9 deletions tests/templatetags.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pytest

from html import escape
from html import unescape

from django.template import RequestContext, Template
from django.test import RequestFactory
Expand Down Expand Up @@ -36,12 +36,12 @@ def test_firm_contact_tag(db, firm_contact_obj):
firm_contact_obj.city,
firm_contact_obj.country,
),
"<p>Address: {}</p>".format(escape(firm_contact_obj.address)),
"<p>city: {}</p>".format(escape(firm_contact_obj.city)),
"<p>postal code: {}</p>".format(escape(firm_contact_obj.postal_code)),
"<p>country: {}</p>".format(escape(firm_contact_obj.country))
"<p>Address: {}</p>".format(firm_contact_obj.address),
"<p>city: {}</p>".format(firm_contact_obj.city),
"<p>postal code: {}</p>".format(firm_contact_obj.postal_code),
"<p>country: {}</p>".format(firm_contact_obj.country)
])
assert rendered == expected_output
assert unescape(rendered) == expected_output


def test_firm_social_links_tag(db, firm_social_links_objs):
Expand Down Expand Up @@ -73,10 +73,10 @@ def test_firm_description_tag(firm_contact_obj):
template = Template(output)
rendered = template.render(context)
expected_output = "\n".join([
f"<p>Baseline: {escape(firm_contact_obj.baseline)}</p>",
f"<p>Short_description: {escape(firm_contact_obj.short_description)}</p>",
f"<p>Baseline: {firm_contact_obj.baseline}</p>",
f"<p>Short_description: {firm_contact_obj.short_description}</p>",
])
assert rendered == expected_output
assert unescape(rendered) == expected_output


@pytest.mark.parametrize(
Expand Down

0 comments on commit c83d1cf

Please sign in to comment.