You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+19-1
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,19 @@
2
2
3
3
## [Unreleased]
4
4
5
+
## [0.5.0] - 2021-06-04
6
+
5
7
### Added
6
8
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/)).
8
18
9
19
## [0.4.0] - 2021-05-20
10
20
@@ -38,24 +48,29 @@ We have a new documentation website! Check out [torchbox.github.io/django-patter
38
48
## [0.2.9] - 2020-07-29
39
49
40
50
### Added
51
+
41
52
- Atomic design no longer enforced and pattern templates can be from several locations, rather than a single location.
42
53
These changes are currently undocumented, see the tests for examples.
43
54
44
55
### Fixed
56
+
45
57
- Templates that are not explicitly part of the pattern library can no longer be rendered by the pattern library
46
58
47
59
## [0.2.8] - 2020-03-13
48
60
49
61
### Added
62
+
50
63
- Moved to github and open sourced
51
64
- Support for Django 3.0
52
65
- Support for Python 3.8
53
66
54
67
### Removed
68
+
55
69
- webpack-dev-server
56
70
- references to old name of 'Mikalab'
57
71
58
72
### Fixed
73
+
59
74
- Documentation links and improved documentation
60
75
- Accessibility issues with pattern library chrome
61
76
- JavaScript in IE11 (added polyfills)
@@ -65,17 +80,20 @@ We have a new documentation website! Check out [torchbox.github.io/django-patter
65
80
## [0.2.5] - 2019-11-01
66
81
67
82
### Added
83
+
68
84
- Switch to Poetry for dependency management
69
85
- Documentation tab for each pattern that will display a markdown file if it is stored along with the html and yaml files
Copy file name to clipboardExpand all lines: docs/reference/known-issues.md
+43-29
Original file line number
Diff line number
Diff line change
@@ -2,38 +2,10 @@
2
2
3
3
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.
4
4
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
-
15
5
## Overriding filters is not supported
16
6
17
7
See [#114](https://github.com/torchbox/django-pattern-library/issues/114). PRs welcome!
18
8
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
-
37
9
## Can’t override context in a child template
38
10
39
11
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
67
39
68
40
## Can’t mock each use of a template tag with different attributes
69
41
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:
71
43
72
44
```django
73
45
{% load wagtailcore_tags %}
@@ -90,8 +62,50 @@ For example, with a template that uses the same tag many times like:
90
62
91
63
This can’t be mocked for all usage of `include_block`.
92
64
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
+
93
103
## Can’t mock objects comparison by reference
94
104
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
+
95
109
With instances of models, the following works fine in vanilla Django, due to `item` and `page` being the same object:
0 commit comments