Skip to content

Commit 6a4db66

Browse files
fix: Pass request object to render_string (#3)
1 parent 34a6ff9 commit 6a4db66

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [1.2.1dev2](https://github.com/lincolnloop/django-pattern-library/releases/tag/v1.2.1dev2) - 2024-04-02
4+
5+
### Fixed
6+
7+
- Pass request object to HTML rendered code view ([#3](https://github.com/lincolnloop/django-pattern-library/pull/3))
8+
39
## [1.2.1dev1](https://github.com/lincolnloop/django-pattern-library/releases/tag/v1.2.1dev1) - 2024-04-02
410

511
### Added

pattern_library/views.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,10 @@ def get(self, request, pattern_template_name=None):
7878
template_context = get_pattern_context(pattern_template_name)
7979
try:
8080
soup = BeautifulSoup(
81-
render_to_string(pattern_template_name, template_context), "html.parser"
81+
render_to_string(
82+
pattern_template_name, template_context, request=request
83+
),
84+
"html.parser",
8285
)
8386
formatter = HTMLFormatter(indent=4)
8487
context["pattern_html_source"] = escape(soup.prettify(formatter=formatter))

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "django-pattern-library"
3-
version = "1.2.1dev1"
3+
version = "1.2.1dev2"
44
description = "A module for Django that allows to build pattern libraries for your projects."
55
authors = [
66
"Ben Dickinson <[email protected]>",

0 commit comments

Comments
 (0)