Skip to content
This repository was archived by the owner on Nov 15, 2022. It is now read-only.

Commit 1f83c71

Browse files
committed
add langs to readme code
1 parent b3b85a9 commit 1f83c71

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ Extending the Django template system so that you can include a view inside anoth
2323

2424
Django View Composer is released on PyPi so you can install using Pip:
2525

26-
```
26+
```sh
2727
pip install django-view-composer
2828
```
2929

3030
or Poetry:
3131

32-
```
32+
```sh
3333
poetry install django-view-composer
3434
```
3535

3636
Once installed, add to your `INSTALLED_APPS` setting to register the template tags:
3737

38-
```
38+
```python
3939
INSTALLED_APPS = [
4040
...
4141
"django_view_composer",
@@ -49,15 +49,15 @@ The `{% view %}` tag renders a class based view and includes the content in the
4949

5050
It has 1 required argument which is the import string for the view:
5151

52-
```
52+
```html+django
5353
{% load view_composer %}
5454
5555
{% view 'myapp.views.MyView' %}
5656
```
5757

5858
You can also provide a variable for the import string which will be resolved from the current template's context:
5959

60-
```
60+
```html+django
6161
{% view view_to_render %}
6262
```
6363

@@ -71,21 +71,21 @@ If any context variable names conflict, whatever the child view sets in it's own
7171

7272
You can pass additional context from the template tag:
7373

74-
```
74+
```html+django
7575
{% view 'myapp.views.MyView' with foo='bar' %}
7676
```
7777

7878
Additional variables can be resolved from the current template's context to pass to the included view:
7979

80-
```
80+
```html+django
8181
{% view 'myapp.views.MyView' with foo=foo %}
8282
```
8383

8484
### Use `only` to limit context
8585

8686
If you want to render the included view only with the variables provided (or even no variables at all), use the only option. No other variables will be provided to the included view.
8787

88-
```
88+
```html+django
8989
{% view 'myapp.views.MyView' with foo='bar' only %}
9090
```
9191

@@ -95,7 +95,7 @@ The `{% viewblock %}` tag renders a class based view and includes the content in
9595

9696
This tag must be closed with a corresponding endviewblock. It has 1 required argument which is the import string for the view:
9797

98-
```
98+
```html+django
9999
{% load view_composer %}
100100
101101
{% viewblock 'myapp.views.MyView' %}
@@ -105,7 +105,7 @@ This tag must be closed with a corresponding endviewblock. It has 1 required arg
105105

106106
In the template for the `myapp.views.MyView`, you can use the children context variable to decide where to render the block content:
107107

108-
```
108+
```html+django
109109
<div>
110110
{{ children }}
111111
</div>
@@ -140,7 +140,7 @@ If you need to handle a different method in an included view, such as a child vi
140140

141141
Using the form as an example:
142142

143-
```
143+
```python
144144
from .views import ItemCreateView
145145

146146
app_name = "myapp"
@@ -149,7 +149,7 @@ url_patterns = [
149149
]
150150
```
151151

152-
```
152+
```html+django
153153
<form method="post" action="{% url 'myapp:item-create-view' %}">
154154
...
155155
</form>

0 commit comments

Comments
 (0)