Skip to content

Commit ec001c1

Browse files
committed
Added inlines support
1 parent 26d1983 commit ec001c1

6 files changed

Lines changed: 17 additions & 11 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Django StreamField
22

33
This is a simple realisation of StreamField's idea of Wagtail CMS for plain Django admin or with Grappelli skin.
4-
Stable version: 2.2.1
4+
Stable version: 2.2.2
55
Django <= 5.0
66

77
[Major changes (1.4.5 > 2)](changes2.0.md)

frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "streamfield_widget.js",
3-
"version": "2.2.1",
3+
"version": "2.2.2",
44
"description": "",
55
"private": true,
66
"scripts": {

frontend/src/streamfield_widget.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,25 @@ import { createApp } from 'vue'
44
import App from '@/components/App.vue'
55

66
(function(){
7+
function initApps(node) {
8+
let app_nodes = node.querySelectorAll(".streamfield_app:not([id*='__prefix__'])");
9+
for (let i = 0; i < app_nodes.length; i++) {
10+
let app_node = app_nodes[i];
11+
let app = createApp(App, {app_node}).mount(app_node.querySelector('.mount-node'));
12+
window.streamapps[app_node.id] = app;
13+
}
14+
}
715
function onReady() {
8-
let streamfield_app = document.querySelectorAll('.streamfield_app');
916
window.ax = axios.create({
1017
headers: {"X-CSRFToken": document.querySelector('[name=csrfmiddlewaretoken]').value}
1118
});
1219
window.streamapps = {};
13-
for (let i = 0; i < streamfield_app.length; i++) {
14-
let app_node =streamfield_app[i];
15-
let app = createApp(App, {app_node}).mount(app_node.querySelector('.mount-node'));
16-
window.streamapps[streamfield_app[i].id] = app;
17-
}
20+
initApps(document)
1821
};
1922
window.addEventListener('DOMContentLoaded', function(event) {
2023
onReady();
2124
});
25+
document.addEventListener("formset:added", function(event) {
26+
initApps(event.target)
27+
});
2228
})();

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="2.2.1",
8+
version="2.2.2",
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 = "2.2.1"
2+
VERSION = "2.2.2"

streamfield/static/streamfield/streamfield_widget.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)