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: README.md
+27-23Lines changed: 27 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ This is a simple realisation of StreamField's idea of Wagtail CMS for plain Djan
6
6
You can build your page with different kind of blocks.
7
7
Sort them and sort the lists inside the blocks.
8
8
9
-
The blocks here are regular instances of Django models. For editing content inside the blocks, it use native popup mechanism in Django admin interface.
9
+
**The blocks here are regular instances of Django models.** For editing content inside the blocks, it use native popup mechanism in Django admin interface.
10
10
This allow you to use other field's widgets inside the blocks as is.
11
11
For example, if you want to use in your blocks FileBrowseField
12
12
from django-filebrowser, it will perfectly working
@@ -41,13 +41,16 @@ Requirements: `django>=2.*`
41
41
`pip install django-streamfield`
42
42
43
43
## How to use
44
+
- Create streamblocks app with your models
45
+
- Add streamfield and streamblocks to INSTALLED_APPS
46
+
- Add streamfield.urls
47
+
- Create templates for streamblocks
48
+
- Add StreamField to your model
49
+
- Use it in templates
44
50
45
-
**1. Create new app called `streamblocks`**
46
-
Here will be your models that you will use as blocks
51
+
**1. Create new app called `streamblocks` and put there some models**
47
52
48
-
**2. Put to `streamblocks/models.py` some models**
49
-
50
-
...that you want to use as blocks in your stream field.
53
+
...that you want to use as blocks in your StreamField.
51
54
Add them to the list `STREAMBLOCKS_MODELS`.
52
55
For example:
53
56
@@ -84,7 +87,7 @@ STREAMBLOCKS_MODELS = [
84
87
> Important!: Don't use 'as_list', 'options', 'extra_options' as models field names, because they are used by streamfield.
85
88
86
89
87
-
**3. Add apps to settings.py**
90
+
**2. Add apps to settings.py**
88
91
89
92
Add to INSTALLED_APPS
90
93
@@ -96,14 +99,14 @@ INSTALLED_APPS = [
96
99
...
97
100
```
98
101
99
-
**4. Add streamfield.urls to main urls.py**
102
+
**3. Add streamfield.urls to main urls.py**
100
103
```python
101
104
urlpatterns += [
102
105
path('streamfield/', include('streamfield.urls'))
103
106
]
104
107
```
105
108
106
-
**5. Create templates for each models above, named as lowercase names of the models:**
109
+
**4. Create templates for each block model, named as lowercase names of the models:**
0 commit comments