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: docs/guides/overriding-template-tags.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -29,7 +29,7 @@ This default is used for any tag that's not passed its own context, allowing spe
29
29
30
30
Currently this feature only supports providing a default for the output of the tag, this does not support modifying context in templates such as `{% an_example_tag page.url as example_variable %}`.
31
31
32
-
###When do I need to override a template tag?
32
+
## When do I need to override a template tag?
33
33
34
34
Ideally your pattern library should be independent, so it doesn't fail when
35
35
you run it with a project that has no entries in DB or on a local machine
@@ -38,7 +38,7 @@ This means that you need to override a template tag when it hits DB or any other
38
38
39
39
You amy also need to override template tags in other cases, when data provided by the pattern library’s context mocking is of a different type to what Django would expect – this is because the pattern library only uses data types that are de-serializable from YAML.
40
40
41
-
###Override modes
41
+
## Override modes
42
42
43
43
There are two options when it comes to template tag overriding:
44
44
@@ -49,7 +49,7 @@ There are two options when it comes to template tag overriding:
49
49
You can also return a structure (dict or list) which is useful when
50
50
overriding ["Simple tags"](https://docs.djangoproject.com/en/2.0/howto/custom-template-tags/#simple-tags) or a custom tag that returns an object or dict
51
51
52
-
###Output into a variable
52
+
## Output into a variable
53
53
54
54
Some tags can set their value into a variable like:
55
55
@@ -71,7 +71,7 @@ But when you need to override a tag which sets result into a variable in
71
71
you would need to specify output var name manually. We will look into how
72
72
to do that later in the examples section.
73
73
74
-
###Overriding examples
74
+
## Overriding examples
75
75
76
76
Let's assume that we want to override the `{% image image resize_rule %}`
77
77
template tag from the `some_package.image_utils` template tag set
@@ -133,7 +133,7 @@ Let's assume that we have a template with two calls of the
133
133
</div>
134
134
```
135
135
136
-
####Render another template or pattern
136
+
### Render another template or pattern
137
137
138
138
Our `yaml` will similar to this:
139
139
@@ -182,7 +182,7 @@ There are two approaches for this problem:
0 commit comments