Skip to content

Commit 4a57c5d

Browse files
authored
Release v0.5.0 (#149)
1 parent ea7bf95 commit 4a57c5d

File tree

4 files changed

+63
-73
lines changed

4 files changed

+63
-73
lines changed

CHANGELOG.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,19 @@
22

33
## [Unreleased]
44

5+
## [0.5.0] - 2021-06-04
6+
57
### Added
68

7-
- Added support for 'context modifiers' - A way to modify template contexts with Python [#141](https://github.com/torchbox/django-pattern-library/pull/141)
9+
Added support for '[context modifiers](https://torchbox.github.io/django-pattern-library/guides/defining-template-context/#modifying-template-contexts-with-python)' - A way to modify template contexts with Python ([#141](https://github.com/torchbox/django-pattern-library/pull/141), [#147](https://github.com/torchbox/django-pattern-library/pull/147), [#106](https://github.com/torchbox/django-pattern-library/issues/106)).
10+
11+
This addresses the following limitations of the pattern library:
12+
13+
- [#10 No way to specify objects that have attributes and support iteration](https://github.com/torchbox/django-pattern-library/issues/10)
14+
- [#113 Django form fields not well supported](https://github.com/torchbox/django-pattern-library/issues/113)
15+
- [#135 Competing tag/context config for image provides inconsistent result](https://github.com/torchbox/django-pattern-library/issues/135)
16+
17+
View the [documentation](https://torchbox.github.io/django-pattern-library/guides/defining-template-context/#modifying-template-contexts-with-python), as well as demos leveraging the new capability: [forms](https://torchbox.github.io/django-pattern-library/demo/pattern-library/pattern/patterns/pages/forms/example_form.html) (see [forms and fields recipe](https://torchbox.github.io/django-pattern-library/recipes/forms-and-fields/)), and [pagination](https://torchbox.github.io/django-pattern-library/demo/pattern-library/pattern/patterns/pages/search/search.html) (see [pagination recipe](https://torchbox.github.io/django-pattern-library/recipes/pagination/)).
818

919
## [0.4.0] - 2021-05-20
1020

@@ -38,24 +48,29 @@ We have a new documentation website! Check out [torchbox.github.io/django-patter
3848
## [0.2.9] - 2020-07-29
3949

4050
### Added
51+
4152
- Atomic design no longer enforced and pattern templates can be from several locations, rather than a single location.
4253
These changes are currently undocumented, see the tests for examples.
4354

4455
### Fixed
56+
4557
- Templates that are not explicitly part of the pattern library can no longer be rendered by the pattern library
4658

4759
## [0.2.8] - 2020-03-13
4860

4961
### Added
62+
5063
- Moved to github and open sourced
5164
- Support for Django 3.0
5265
- Support for Python 3.8
5366

5467
### Removed
68+
5569
- webpack-dev-server
5670
- references to old name of 'Mikalab'
5771

5872
### Fixed
73+
5974
- Documentation links and improved documentation
6075
- Accessibility issues with pattern library chrome
6176
- JavaScript in IE11 (added polyfills)
@@ -65,17 +80,20 @@ We have a new documentation website! Check out [torchbox.github.io/django-patter
6580
## [0.2.5] - 2019-11-01
6681

6782
### Added
83+
6884
- Switch to Poetry for dependency management
6985
- Documentation tab for each pattern that will display a markdown file if it is stored along with the html and yaml files
7086
- Extra yaml examples in the README
7187
- Merge request template
7288

7389
### Changed
90+
7491
- Improve documentation for developers
7592

7693
## [0.2.4] - 2019-06-11
7794

7895
### Added
96+
7997
- Compatibility with Django 2.2
8098

8199
[0.2.9]: https://github.com/torchbox/django-pattern-library/releases/tag/v0.2.9

docs/reference/known-issues.md

+43-29
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,10 @@
22

33
django-pattern-library has a few known limitations due to its design, which are worth knowing about when authoring templates or attempting to document them in the pattern library.
44

5-
## No way to specify objects that have attributes and support iteration
6-
7-
See [#10](https://github.com/torchbox/django-pattern-library/issues/10). It’s impossible to mock the context when a variable needs to support iteration _and_ attributes. Here is an example of this impossible case:
8-
9-
```django
10-
{% for result in search_results %}
11-
{# […] #}
12-
{% if search_results.paginator.count %}
13-
```
14-
155
## Overriding filters is not supported
166

177
See [#114](https://github.com/torchbox/django-pattern-library/issues/114). PRs welcome!
188

19-
## Django form fields are not well supported
20-
21-
See [#113](https://github.com/torchbox/django-pattern-library/issues/113). If a template contains `{% for field in form %}` or even `{% if form %}`, then it's easy enough to render in django-pattern-library so long as we force the form to be null in the YAML context, and are happy not to have the form.
22-
23-
If the form is rendered explicitly by field names, then it requires a lot more work, which can quickly become too much of a maintenance burden – for example creating deeply nested structures for form fields:
24-
25-
```yaml
26-
form:
27-
email:
28-
bound_field:
29-
field:
30-
widget:
31-
class:
32-
__name__: char_field
33-
```
34-
35-
While this is in theory possible, it’s not a very desirable prospect.
36-
379
## Can’t override context in a child template
3810

3911
See [#8](https://github.com/torchbox/django-pattern-library/issues/8).
@@ -67,7 +39,7 @@ This can be worked around by creating pattern-library-only templates, see [Multi
6739

6840
## Can’t mock each use of a template tag with different attributes
6941

70-
For example, with a template that uses the same tag many times like:
42+
See [#138](https://github.com/torchbox/django-pattern-library/issues/138). For example, with a template that uses the same tag many times like:
7143

7244
```django
7345
{% load wagtailcore_tags %}
@@ -90,8 +62,50 @@ For example, with a template that uses the same tag many times like:
9062

9163
This can’t be mocked for all usage of `include_block`.
9264

65+
## Past limitations
66+
67+
### No way to specify objects that have attributes and support iteration
68+
69+
🎉 This is now addressed as of v0.5.0, with the [context modifiers in Python](../guides/defining-template-context.md#modifying-template-contexts-with-python) API. View our [pagination](../recipes/pagination.md) recipe.
70+
71+
---
72+
73+
See [#10](https://github.com/torchbox/django-pattern-library/issues/10). It’s impossible to mock the context when a variable needs to support iteration _and_ attributes. Here is an example of this impossible case:
74+
75+
```django
76+
{% for result in search_results %}
77+
{# […] #}
78+
{% if search_results.paginator.count %}
79+
```
80+
81+
## Django form fields are not well supported
82+
83+
🎉 This is now addressed as of v0.5.0, with the [context modifiers in Python](../guides/defining-template-context.md#modifying-template-contexts-with-python) API. View our [forms and fields](../recipes/forms-and-fields.md) recipe.
84+
85+
---
86+
87+
See [#113](https://github.com/torchbox/django-pattern-library/issues/113). If a template contains `{% for field in form %}` or even `{% if form %}`, then it's easy enough to render in django-pattern-library so long as we force the form to be null in the YAML context, and are happy not to have the form.
88+
89+
If the form is rendered explicitly by field names, then it requires a lot more work, which can quickly become too much of a maintenance burden – for example creating deeply nested structures for form fields:
90+
91+
```yaml
92+
form:
93+
email:
94+
bound_field:
95+
field:
96+
widget:
97+
class:
98+
__name__: char_field
99+
```
100+
101+
While this is in theory possible, it’s not a very desirable prospect.
102+
93103
## Can’t mock objects comparison by reference
94104

105+
🎉 This is now addressed as of v0.5.0, with the [context modifiers in Python](../guides/defining-template-context.md#modifying-template-contexts-with-python) API.
106+
107+
---
108+
95109
With instances of models, the following works fine in vanilla Django, due to `item` and `page` being the same object:
96110

97111
```django

pyproject.toml

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

questions.md

-42
This file was deleted.

0 commit comments

Comments
 (0)