Skip to content

Commit 751f884

Browse files
committed
v1.3.4. Possibility to extends default admin form template
1 parent fa735ab commit 751f884

4 files changed

Lines changed: 18 additions & 4 deletions

File tree

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,7 @@ Or, if you need extra context in blocks, you may use template tag:
185185
</div>
186186
...
187187
```
188+
Third way it's to use list. [See bellow](#get-field-data-as-list)
188189

189190

190191
## Admin
@@ -215,11 +216,22 @@ For example for RichText block it will be:
215216

216217
`streamblocks/templates/streamblocks/admin/richtext.html`
217218

218-
As context use "form":
219+
As context use "form" and/or "object":
219220
```html
220221
{{ form.text.value }}
222+
{{ object }}
221223
```
222224

225+
The default admin template is: `streamfield/admin/change_form_render_template.html`
226+
You can extend it.
227+
{% extends "streamfield/admin/change_form_render_template.html" %}
228+
{% block streamblock_form %}
229+
{{ block.super }}
230+
Original object is: {{ object }}
231+
{% endblock streamblock_form %}
232+
233+
234+
223235
You may also specify custom template as option:
224236
```python
225237
class RichText(models.Model):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="django-streamfield",
8-
version="1.3.3",
8+
version="1.3.4",
99
author="Yury Lapshinov",
1010
author_email="y.raagin@gmail.com",
1111
description="StreamField for native Django Admin or with Grappelli",

streamfield/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
name = "streamfield"
2-
VERSION = '1.3.3'
2+
VERSION = '1.3.4'

streamfield/templates/streamfield/admin/change_form_render_template.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{% load streamfield_tags %}
2+
{% block streamblock_form %}
23
<div class="block-fields">
34
{% for f in form %}
45
{% if f.value %}
@@ -8,4 +9,5 @@
89
</div>
910
{% endif %}
1011
{% endfor %}
11-
</div>
12+
</div>
13+
{% endblock streamblock_form %}

0 commit comments

Comments
 (0)