@@ -43,7 +43,7 @@ your_app/
43
43
├── asgi.py
44
44
├── settings.py
45
45
├── urls.py
46
- └── sub_app /
46
+ └── example_app /
47
47
├── __init__.py
48
48
├── idom.py
49
49
├── templates/
@@ -120,7 +120,7 @@ urlpatterns = [
120
120
]
121
121
```
122
122
123
- ## ` sub_app /components.py`
123
+ ## ` example_app /components.py`
124
124
125
125
This is where, by a convention similar to that of
126
126
[ ` views.py ` ] ( https://docs.djangoproject.com/en/3.2/topics/http/views/ ) , you'll define
@@ -136,7 +136,7 @@ def Hello(name): # component names are camelcase by convention
136
136
return Header(f " Hello { name} ! " )
137
137
```
138
138
139
- ## ` sub_app /templates/your-template.html`
139
+ ## ` example_app /templates/your-template.html`
140
140
141
141
In your templates, you may inject a view of an IDOM component into your templated HTML
142
142
by using the ` idom_view ` template tag. This tag which requires the name of a component
@@ -149,7 +149,7 @@ idom_view module_name.ComponentName param_1="something" param_2="something-else"
149
149
150
150
In context this will look a bit like the following...
151
151
152
- ``` html
152
+ ``` jinja
153
153
<!-- don't forget your load statements -->
154
154
{% load static %}
155
155
{% load idom %}
@@ -158,15 +158,15 @@ In context this will look a bit like the following...
158
158
<html>
159
159
<body>
160
160
...
161
- {% idom_view "your_app.sub_app .components.Hello" name="World" %}
161
+ {% idom_view "your_app.example_app .components.Hello" name="World" %}
162
162
</body>
163
163
</html>
164
164
```
165
165
166
- Your view for this template can be defined just
167
- [ like any other] ( https://docs.djangoproject.com/en/3.2/intro/tutorial03/#write-views-that-actually-do-something ) .
166
+ ## ` example_app/views.py `
168
167
169
- ## ` sub_app/views.py `
168
+ You can then serve ` your-template.html ` from a view just
169
+ [ like any other] ( https://docs.djangoproject.com/en/3.2/intro/tutorial03/#write-views-that-actually-do-something ) .
170
170
171
171
``` python
172
172
from django.http import HttpResponse
@@ -180,7 +180,7 @@ def your_template(request):
180
180
)
181
181
```
182
182
183
- ## ` sub_app /urls.py`
183
+ ## ` example_app /urls.py`
184
184
185
185
Include your replate in the list of urlpatterns
186
186
0 commit comments