udata 11.0.1.dev37741__py2.py3-none-any.whl → 11.0.2.dev37787__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of udata might be problematic. Click here for more details.
- udata/__init__.py +1 -1
- udata/core/topic/forms.py +17 -14
- udata/static/chunks/{10.8ca60413647062717b1e.js → 10.471164b2a9fe15614797.js} +3 -3
- udata/static/chunks/{10.8ca60413647062717b1e.js.map → 10.471164b2a9fe15614797.js.map} +1 -1
- udata/static/chunks/{11.b6f741fcc366abfad9c4.js → 11.83535504cd650ea08f65.js} +3 -3
- udata/static/chunks/{11.b6f741fcc366abfad9c4.js.map → 11.83535504cd650ea08f65.js.map} +1 -1
- udata/static/chunks/{13.2d06442dd9a05d9777b5.js → 13.d9c1735d14038b94c17e.js} +2 -2
- udata/static/chunks/{13.2d06442dd9a05d9777b5.js.map → 13.d9c1735d14038b94c17e.js.map} +1 -1
- udata/static/chunks/{17.e8e4caaad5cb0cc0bacc.js → 17.81c57c0dedf812e43013.js} +2 -2
- udata/static/chunks/{17.e8e4caaad5cb0cc0bacc.js.map → 17.81c57c0dedf812e43013.js.map} +1 -1
- udata/static/chunks/{19.f03a102365af4315f9db.js → 19.df16abde17a42033a7f8.js} +3 -3
- udata/static/chunks/{19.f03a102365af4315f9db.js.map → 19.df16abde17a42033a7f8.js.map} +1 -1
- udata/static/chunks/{8.778091d55cd8ea39af6b.js → 8.462bb3029de008497675.js} +2 -2
- udata/static/chunks/{8.778091d55cd8ea39af6b.js.map → 8.462bb3029de008497675.js.map} +1 -1
- udata/static/chunks/{9.033d7e190ca9e226a5d0.js → 9.07515e5187f475bce828.js} +3 -3
- udata/static/chunks/{9.033d7e190ca9e226a5d0.js.map → 9.07515e5187f475bce828.js.map} +1 -1
- udata/static/common.js +1 -1
- udata/static/common.js.map +1 -1
- udata/tests/apiv2/test_topics.py +26 -0
- {udata-11.0.1.dev37741.dist-info → udata-11.0.2.dev37787.dist-info}/METADATA +5 -1
- {udata-11.0.1.dev37741.dist-info → udata-11.0.2.dev37787.dist-info}/RECORD +25 -25
- {udata-11.0.1.dev37741.dist-info → udata-11.0.2.dev37787.dist-info}/LICENSE +0 -0
- {udata-11.0.1.dev37741.dist-info → udata-11.0.2.dev37787.dist-info}/WHEEL +0 -0
- {udata-11.0.1.dev37741.dist-info → udata-11.0.2.dev37787.dist-info}/entry_points.txt +0 -0
- {udata-11.0.1.dev37741.dist-info → udata-11.0.2.dev37787.dist-info}/top_level.txt +0 -0
udata/__init__.py
CHANGED
udata/core/topic/forms.py
CHANGED
|
@@ -58,24 +58,27 @@ class TopicForm(ModelForm):
|
|
|
58
58
|
"""Custom save to handle TopicElement creation properly"""
|
|
59
59
|
# Store elements data before parent save
|
|
60
60
|
elements_data = self.elements.data
|
|
61
|
+
# Check if elements field was explicitly provided
|
|
62
|
+
elements_provided = self.elements.has_data
|
|
61
63
|
|
|
62
64
|
# Use parent save method (elements field is excluded via populate_obj)
|
|
63
65
|
topic = super().save(commit=commit, **kwargs)
|
|
64
66
|
|
|
65
|
-
#
|
|
66
|
-
if
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
67
|
+
# Only clear and recreate elements if they were explicitly provided in the payload
|
|
68
|
+
if elements_provided:
|
|
69
|
+
if commit:
|
|
70
|
+
TopicElement.objects(topic=topic).delete()
|
|
71
|
+
|
|
72
|
+
# Create elements and associate them with the topic
|
|
73
|
+
for element_data in elements_data or []:
|
|
74
|
+
# Create element form with only its own data, not inheriting from parent
|
|
75
|
+
element_form = TopicElementForm(meta={"csrf": False})
|
|
76
|
+
element_form.process(data=element_data)
|
|
77
|
+
if element_form.validate():
|
|
78
|
+
element = element_form.save(commit=False)
|
|
79
|
+
element.topic = topic
|
|
80
|
+
if commit:
|
|
81
|
+
element.save()
|
|
79
82
|
|
|
80
83
|
return topic
|
|
81
84
|
|