1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00
Commit Graph

137 Commits

Author SHA1 Message Date
Sarah Boyce
d783a6f1c0 Improved assert_serializer test assertions in test.serializers. 2024-12-02 08:35:55 +01:00
Sarah Boyce
a444d2600b Used skipIf/UnlessDBFeature in test.serializers. 2024-12-02 08:35:55 +01:00
Adam Zapletal
1636912bf1 Refs #21286 -- Fixed serializer test with primary key TextField. 2024-11-28 11:45:34 +01:00
Adam Zapletal
b9aa3239ab Refs #21286 -- Fixed YAML serialization of TimeField primary key.
Handling for PyYAML not being able to serialize `datetime.time`
values is moved from `handle_field` to `_value_from_field` as only
non-primary key, non-relation fields are passed into `handle_field`.
2024-11-12 13:23:14 +01:00
SaJH
0c81775515 Refs #35727 -- Updated response.content.decode calls to use the HttpResponse.text property.
Signed-off-by: SaJH <wogur981208@gmail.com>
2024-10-16 11:52:22 +02:00
Mariusz Felisiak
1fa8493640 Refs #29522 -- Fixed serializers/fixtures test crash if PyYAML isn't installed. 2024-09-19 08:51:30 +02:00
Amir Karimi
ee5147cfd7 Fixed #29522 -- Refactored the Deserializer functions to classes.
Co-authored-by: Emad Mokhtar <emad.mokhtar@veneficus.nl>
2024-09-17 11:00:49 +02:00
Adam Zapletal
3d4fe39bac Refs #21286 -- Removed invalid commented out models and tests from serializer tests.
FileField/ImageField cannot be primary keys, so serialization support
for this case will not be implemented.

XMLField was removed in d1290b5b43.
2024-03-04 11:38:18 +01:00
Mariusz Felisiak
305757aec1
Applied Black's 2024 stable style.
https://github.com/psf/black/releases/tag/24.1.0
2024-01-26 12:45:07 +01:00
konsti
48a1929ca0
Removed unnecessary trailing commas in tests. 2023-08-22 12:42:57 +02:00
Juan Alvarez
517d3bb4dd Fixed #34779 -- Avoided unnecessary selection of non-nullable m2m fields without natural keys during serialization.
By using `select_related(None)` instead of `select_related()`, the
unnecessary joins are completely avoided. Note that the current tests
already covers the change, when the field is not `null=True`.

Regression in f9936deed1.
2023-08-19 10:29:43 +02:00
Mariusz Felisiak
f9936deed1
Fixed #34620 -- Fixed serialization crash on m2m fields without natural keys when base querysets use select_related().
Regression in 19e0587ee5.

Thanks Martin Svoboda for the report.
2023-06-04 20:49:07 +02:00
David Smith
097e3a70c1 Refs #33476 -- Applied Black's 2023 stable style.
Black 23.1.0 is released which, as the first release of the year,
introduces the 2023 stable style. This incorporates most of last year's
preview style.

https://github.com/psf/black/releases/tag/23.1.0
2023-02-01 11:04:38 +01:00
Mariusz Felisiak
b119f4329c Refs #29708 -- Removed PickleSerializer per deprecation timeline. 2023-01-17 11:49:15 +01:00
Mark Evans
19e0587ee5 Fixed #33937 -- Optimized serialization of related m2m fields without natural keys. 2022-09-05 20:23:32 +02:00
Mariusz Felisiak
8e89dfe1c2 Fixed various tests on MySQL with MyISAM storage engine. 2022-04-18 07:05:52 +02:00
Nick Pope
847f46e9bf
Removed redundant QuerySet.all() calls in docs and tests.
Most QuerySet methods are mapped onto the Manager and, in general,
it isn't necessary to call .all() on the manager.
2022-02-22 10:29:38 +01:00
Mariusz Felisiak
7119f40c98 Refs #33476 -- Refactored code to strictly match 88 characters line length. 2022-02-07 20:37:05 +01:00
django-bot
9c19aff7c7 Refs #33476 -- Reformatted code with Black. 2022-02-07 20:37:05 +01:00
Adam Johnson
45a42aabfa Fixed #29708 -- Deprecated PickleSerializer. 2022-01-13 13:50:20 +01:00
Daniyal Abbasi
dca4c2ff76 Refs #33012 -- Moved PickleSerializer to django.core.serializers.base and added tests. 2021-09-02 11:24:55 +02:00
Mikolaj Rybinski
8e90560aa8 Fixed #32420 -- Fixed detecting primary key values in deserialization when PK is also a FK. 2021-02-05 12:33:43 +01:00
Mariusz Felisiak
d992f4e3c2 Refs #31369 -- Removed models.NullBooleanField per deprecation timeline. 2021-01-14 17:50:04 +01:00
Ahmad A. Hussein
493b26bbfc Fixed #31888 -- Avoided module-level MySQL queries in tests. 2020-08-17 09:31:16 +02:00
Mariusz Felisiak
83f55aafdd
Fixed #17653 -- Allowed using zero as AutoFields value on MySQL if NO_AUTO_VALUE_ON_ZERO SQL mode is enabled. 2020-07-20 09:48:31 +02:00
Mariusz Felisiak
78c811334c
Refs #30190 -- Minor edits to JSONL serializer.
Follow up to e29637681b.
2020-06-17 07:59:40 +02:00
Ali Vakilzade
e29637681b
Fixed #30190 -- Added JSONL serializer. 2020-06-16 16:51:58 +02:00
Claude Paroz
adf58311b8 Fixed #29078 -- Made serializers respect prefetch_related() for m2m fields. 2020-05-25 10:45:16 +02:00
Simon Charette
94f63b926f Refs #31395 -- Relied on setUpTestData() test data isolation in various tests. 2020-05-15 20:22:56 +02:00
Nick Pope
8f10ceaa90 Changed '%s' % value pattern to str(value). 2020-05-04 08:27:18 +02:00
Hasan Ramezani
68fc21b378 Fixed #29249 -- Made JSON and YAML serializers use Unicode by default. 2020-04-28 11:11:39 +02:00
Hasan Ramezani
8970bb4cfd Refs #29249 -- Added tests for serializing Unicode data with XML serializer. 2020-04-28 11:11:39 +02:00
Mariusz Felisiak
cf21fc9bf0
Enforced uniqueness of natural keys used in tests. 2020-04-07 10:54:19 +02:00
Hasan Ramezani
fc4f45ebdc Used assertRaisesMessage() in various tests. 2020-02-07 12:46:23 +01:00
Simon Charette
5779cc938a Fixed #31071 -- Disabled insert optimization for primary keys with defaults when loading fixtures.
Model.save_base() is called directly when loading fixtures and assumes
existing rows will be updated. Branching of "raw" allows to maintain
the optimization introduced in #29260 while supporting this edge case.

Regression in 85458e94e3.

Thanks Reupen Shah for the report.
2019-12-30 07:49:10 +01:00
Baptiste Mispelon
738e9e615d Fixed #26743 -- Fixed UnboundLocalError crash when deserializing m2m fields and value isn't iterable. 2019-12-13 11:38:09 +01:00
Caio Ariede
555bebe774 Fixed #30987 -- Added models.PositiveBigIntegerField. 2019-11-19 09:34:11 +01:00
Min ho Kim
65e86948b8 Corrected several typos in string literals and test names. 2019-08-07 11:23:14 +02:00
Nadège Michel
fb54aca540 Added test for serializing child model without inherited fields. 2019-06-27 15:10:22 +02:00
Nadège Michel
895b15771e Fixed #28725 -- Prevented serializing inherited ManyToManyFields in child model. 2019-06-27 15:10:22 +02:00
Tobias Kunze
a9b8898242 Refs #11929 -- Fixed ordering of test YAML dumps.
Thanks Nick Pope for the review.
2019-05-03 10:48:18 +02:00
Mariusz Felisiak
9006189c0e
Removed unused YamlSerializerTestCase.fwd_ref_str.
Unused since its introduction in febd5aeec6.
2019-05-03 10:00:06 +02:00
Tim Graham
55490ac746 Fixed serializers test crash if PyYAML isn't installed.
Follow up to a57c783dd4.
2019-03-20 09:23:50 -04:00
Mariusz Felisiak
a57c783dd4 Fixed serializers tests for PyYAML 5.1+. 2019-03-14 13:16:48 -04:00
Matt Wiens
e817ae74da Followed style guide for model attribute ordering. 2018-12-27 19:34:14 -05:00
dmytryi.striletskyi
dcd1025f4c Fixed #28385 -- Fixed deserializing natural keys when primary key has a default value.
Co-Authored-By: Hasan Ramezani <hasan.r67@gmail.com>
2018-11-27 18:35:19 -05:00
Peter Inglesby
312eb5cb11 Fixed #26291 -- Allowed loaddata to handle forward references in natural_key fixtures. 2018-07-13 17:54:47 -04:00
Tim Graham
5fa4f40f45 Fixed #29227 -- Allowed BooleanField to be null=True.
Thanks Lynn Cyrin for contributing to the patch, and Nick Pope for review.
2018-03-20 12:10:10 -04:00
Denys Duchier
cb7860cced Fixed #24607 -- Serialized natural keys in multi-table inheritance models.
Thanks João Paulo Melo de Sampaio for the test.
2018-02-12 21:15:04 -05:00
Tim Graham
acc8dd4142
Fixed #28984 -- Made assorted code simplifications. 2018-01-03 13:24:02 -05:00