udata 11.0.1.dev37741__py2.py3-none-any.whl → 11.0.1.dev37781__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/core/topic/forms.py +17 -14
- udata/tests/apiv2/test_topics.py +26 -0
- {udata-11.0.1.dev37741.dist-info → udata-11.0.1.dev37781.dist-info}/METADATA +2 -2
- {udata-11.0.1.dev37741.dist-info → udata-11.0.1.dev37781.dist-info}/RECORD +8 -8
- {udata-11.0.1.dev37741.dist-info → udata-11.0.1.dev37781.dist-info}/LICENSE +0 -0
- {udata-11.0.1.dev37741.dist-info → udata-11.0.1.dev37781.dist-info}/WHEEL +0 -0
- {udata-11.0.1.dev37741.dist-info → udata-11.0.1.dev37781.dist-info}/entry_points.txt +0 -0
- {udata-11.0.1.dev37741.dist-info → udata-11.0.1.dev37781.dist-info}/top_level.txt +0 -0
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
|
|
udata/tests/apiv2/test_topics.py
CHANGED
|
@@ -295,6 +295,32 @@ class TopicAPITest(APITestCase):
|
|
|
295
295
|
topic.reload()
|
|
296
296
|
self.assertEqual(len(topic.elements), initial_length + 1)
|
|
297
297
|
|
|
298
|
+
def test_topic_api_update_without_elements(self):
|
|
299
|
+
"""It should update a topic without affecting existing elements when elements field is not provided"""
|
|
300
|
+
user = self.login()
|
|
301
|
+
topic = TopicWithElementsFactory(owner=user)
|
|
302
|
+
initial_element_ids = [str(elt.id) for elt in topic.elements]
|
|
303
|
+
|
|
304
|
+
# Update topic without including elements field
|
|
305
|
+
data = {
|
|
306
|
+
"name": "Updated topic name",
|
|
307
|
+
"description": "Updated description",
|
|
308
|
+
"tags": ["updated-tag"],
|
|
309
|
+
}
|
|
310
|
+
response = self.put(url_for("apiv2.topic", topic=topic), data)
|
|
311
|
+
self.assert200(response)
|
|
312
|
+
|
|
313
|
+
# Reload and verify elements are preserved
|
|
314
|
+
topic.reload()
|
|
315
|
+
self.assertEqual(len(topic.elements), len(initial_element_ids))
|
|
316
|
+
current_element_ids = [str(elt.id) for elt in topic.elements]
|
|
317
|
+
self.assertEqual(set(current_element_ids), set(initial_element_ids))
|
|
318
|
+
|
|
319
|
+
# Verify other fields were updated
|
|
320
|
+
self.assertEqual(topic.name, "Updated topic name")
|
|
321
|
+
self.assertEqual(topic.description, "Updated description")
|
|
322
|
+
self.assertEqual(topic.tags, ["updated-tag"])
|
|
323
|
+
|
|
298
324
|
def test_topic_api_delete(self):
|
|
299
325
|
"""It should delete a topic from the API"""
|
|
300
326
|
owner = self.login()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: udata
|
|
3
|
-
Version: 11.0.1.
|
|
3
|
+
Version: 11.0.1.dev37781
|
|
4
4
|
Summary: Open data portal
|
|
5
5
|
Home-page: https://github.com/opendatateam/udata
|
|
6
6
|
Author: Opendata Team
|
|
@@ -144,7 +144,7 @@ It is collectively taken care of by members of the
|
|
|
144
144
|
|
|
145
145
|
## Current (in progress)
|
|
146
146
|
|
|
147
|
-
-
|
|
147
|
+
- fix: PUT topic without elements [#3424](https://github.com/opendatateam/udata/pull/3424)
|
|
148
148
|
|
|
149
149
|
## 11.0.0 (2025-09-12)
|
|
150
150
|
|
|
@@ -243,7 +243,7 @@ udata/core/topic/activities.py,sha256=Pcqhs-OxmSV2NlN18GyV12z9AW8tfS8glgwwmchcbp
|
|
|
243
243
|
udata/core/topic/api_fields.py,sha256=4H904dYR62uhW7XXgCgOrlBwKjFE7h878hQgLbMpRXk,3327
|
|
244
244
|
udata/core/topic/apiv2.py,sha256=RyJIA9UEMURyyuh4gt_yHkAxIM2OwUroGctp-1PVk94,6393
|
|
245
245
|
udata/core/topic/factories.py,sha256=6UYvt4Rf0dxP1pec1ySQySiq82A58VN0uo-7mnbFnuw,2767
|
|
246
|
-
udata/core/topic/forms.py,sha256=
|
|
246
|
+
udata/core/topic/forms.py,sha256=OkWFo0FkSnjZ2LURoq2i2cpingFz1TrOEI3TJ7qQ8pk,3465
|
|
247
247
|
udata/core/topic/models.py,sha256=FdNJViwPNoPNfSdcvcCxI_dbQ71zdaj4wF9lRuGhd3I,3755
|
|
248
248
|
udata/core/topic/parsers.py,sha256=leQtzLtEIV-0lCu_ibsygJoE2e6qAWzpDPer4BhPPjM,3878
|
|
249
249
|
udata/core/topic/permissions.py,sha256=RtFPPlxuU_Bv7ip6LDO4AoPrKFnIOEs9cCMXaSSmEdk,118
|
|
@@ -675,7 +675,7 @@ udata/tests/apiv2/test_datasets.py,sha256=5HYB3UWWKRsIoLx007ZJ1Bx0IU7YzK-_z8VtoM
|
|
|
675
675
|
udata/tests/apiv2/test_me_api.py,sha256=WgUjujSnIlISUkM5t-lfg-D0mmz-eX1hSsSwjuxqbJg,1417
|
|
676
676
|
udata/tests/apiv2/test_organizations.py,sha256=os_43s-coSRqjgY-5fAjSiRlB3g2685u7d-Es0aOhks,6390
|
|
677
677
|
udata/tests/apiv2/test_swagger.py,sha256=RKedaq-2UeyEuxlmUaAN7pmEe-lQYYmpDUVc8HF3CH4,785
|
|
678
|
-
udata/tests/apiv2/test_topics.py,sha256=
|
|
678
|
+
udata/tests/apiv2/test_topics.py,sha256=TFipUDUIWRY8oT20GAwk3wH-u6z5eG9MJ3h0ZZEViE0,27862
|
|
679
679
|
udata/tests/cli/test_cli_base.py,sha256=0a3U_5ROp1lCTG8d6TpCjF4nbKVNerAeLO0VxU-NTUk,321
|
|
680
680
|
udata/tests/cli/test_db_cli.py,sha256=xFVHQAk2bmQQzFr31TK2JThOP6p0wvxzexMhM_IcdME,2219
|
|
681
681
|
udata/tests/contact_point/test_contact_point_models.py,sha256=b8vraZPPrs9LeQMWLnOCrpI02sXMEM_BcMJXKTeAuAw,923
|
|
@@ -766,9 +766,9 @@ udata/translations/pt/LC_MESSAGES/udata.mo,sha256=U0abG-nBwCIoYxRZNsc4KOLeIRSqTV
|
|
|
766
766
|
udata/translations/pt/LC_MESSAGES/udata.po,sha256=eCG35rMzYLHXyLbsnLSexS1g0N_K-WpNHqrt_8y6I4E,48590
|
|
767
767
|
udata/translations/sr/LC_MESSAGES/udata.mo,sha256=IBcCAdmcvkeK7ZeRBNRI-wJ0jzWNM0eXM5VXAc1frWI,28692
|
|
768
768
|
udata/translations/sr/LC_MESSAGES/udata.po,sha256=yFxHEEB4behNwQ7JnyoYheiCKLNnMS_NV4guzgyzWcE,55332
|
|
769
|
-
udata-11.0.1.
|
|
770
|
-
udata-11.0.1.
|
|
771
|
-
udata-11.0.1.
|
|
772
|
-
udata-11.0.1.
|
|
773
|
-
udata-11.0.1.
|
|
774
|
-
udata-11.0.1.
|
|
769
|
+
udata-11.0.1.dev37781.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
|
|
770
|
+
udata-11.0.1.dev37781.dist-info/METADATA,sha256=y_Q3fPaqKsst_77ALWIC6htfAaQ59xnOR46evnFeAlE,155351
|
|
771
|
+
udata-11.0.1.dev37781.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
|
|
772
|
+
udata-11.0.1.dev37781.dist-info/entry_points.txt,sha256=v2u12qO11i2lyLNIp136WmLJ-NHT-Kew3Duu8J-AXPM,614
|
|
773
|
+
udata-11.0.1.dev37781.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
|
|
774
|
+
udata-11.0.1.dev37781.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|