1
0
mirror of https://github.com/django/django.git synced 2024-12-27 19:46:22 +00:00
Commit Graph

101 Commits

Author SHA1 Message Date
Natalia
691f70c477 Fixed #24561 -- Added support for callables on model fields' choices. 2023-09-14 10:15:33 -03:00
Nick Pope
500e01073a
Fixed #31262 -- Added support for mappings on model fields and ChoiceField's choices. 2023-08-30 22:57:40 -03:00
Natalia
f1c0a3baf7 Added tests for model field's choices iterator/iterable values. 2023-08-22 05:55:23 +02:00
T. Franzel
a2eaea8f22 Fixed #34388 -- Allowed using choice enumeration types directly on model and form fields. 2023-03-21 19:44:41 +01:00
Mariusz Felisiak
1760ad4e8c
Relaxed some query ordering assertions in various tests.
It accounts for differences seen on MySQL with MyISAM storage engine.
2022-04-14 12:12:13 +02:00
django-bot
9c19aff7c7 Refs #33476 -- Reformatted code with Black. 2022-02-07 20:37:05 +01:00
Adam Johnson
fdfa97fb16 Fixed #33441 -- Restored immutability of models.Field.__hash__().
Regression in 502e75f9ed.
2022-01-14 07:00:48 +01:00
Mariusz Felisiak
d992f4e3c2 Refs #31369 -- Removed models.NullBooleanField per deprecation timeline. 2021-01-14 17:50:04 +01:00
Ryan Hiebert
502e75f9ed Fixed #31750 -- Made models.Field equality compare models for inherited fields. 2020-09-09 20:52:59 +02:00
Carlton Gibson
29c126bb34 Fixed #31124 -- Fixed setting of get_FOO_display() when overriding inherited choices.
Regression in 2d38eb0ab9
2020-01-15 15:35:22 +01:00
Carlton Gibson
2d38eb0ab9 Fixed #30931 -- Restored ability to override Model.get_FIELD_display().
Thanks Sergey Fedoseev for the implementation idea.

Regression in a68ea23101.
2019-11-04 07:55:34 +01:00
Dan Moore
bc94e3c1a2 Fixed #29919 -- Fixed RelatedOnlyFieldListFilter crash with reverse relationships. 2019-10-23 10:50:31 +02:00
Dan Moore
f3855a8d2d Added tests for Field.get_choices()'s limit_choices_to argument. 2019-10-23 10:47:17 +02:00
zeyneloz
00035672a4 Fixed #30449 -- Fixed RelatedFieldListFilter/RelatedOnlyFieldListFilter to respect model's Meta.ordering.
Regression in 6d4e5feb79.

Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2019-08-15 10:29:05 +02:00
Matthias Kestenholz
ea60b7bc74 Removed redundant model field choices tests. 2019-03-23 12:04:39 -04:00
Joshua Cannon
16a5a2a2c8 Fixed #30076 -- Added Model.get_FOO_display() even if field's choices are empty. 2019-01-30 13:44:10 -05:00
Tim Graham
193c109327 Switched TestCase to SimpleTestCase where possible in Django's tests. 2018-11-27 08:58:44 -05:00
Hasan Ramezani
6d4e5feb79 Fixed #29835 -- Made RelatedFieldListFilter respect ModelAdmin.ordering. 2018-11-14 14:29:39 -05:00
orlnub123
21420096c4 Fixed #29247 -- Allowed blank model field choice to be defined in nested choices. 2018-04-20 11:06:14 -04:00
Tim Graham
e35004966b Moved tests for model Field.get_choices(). 2018-04-20 11:05:25 -04:00
Jon Dufresne
fa283067c9 Removed unnecessary empty parentheses in class definitions. 2017-06-26 10:31:32 -04:00
chillaranand
fb0f987f7d Fixed #27914 -- Added support for nested classes in Field.deconstruct()/__repr__(). 2017-06-14 10:10:17 -04:00
Tim Graham
a9874d48b1 Fixed #28188 -- Fixed crash when pickling model fields.
Regression in d2a26c1a90.

Thanks Adam Alton for the report and test, and Adam Johnson for
suggesting the fix.
2017-05-11 21:04:52 -04:00
Kapil Garg
7e09fa7f51 Fixed #27969 -- Fixed models.Field.formfield() setting 'disabled' for fields with choices. 2017-03-23 13:22:04 -04:00
Tim Graham
bcf3532ede Refs #26154 -- Removed deprecated CommaSeparatedIntegerField. 2017-01-17 20:52:02 -05:00
Morgan Aubert
ef889d5b10 Fixed #27599 -- Fixed Field.__str__() crash for fields not attached to models. 2016-12-14 14:04:26 -05:00
Morgan Aubert
adb791fdcb Moved test_field_ordering to the model_fields package. 2016-12-14 13:35:13 -05:00
Jon Dufresne
4f336f6652 Fixed #26747 -- Used more specific assertions in the Django test suite. 2016-06-16 14:19:18 -04:00
Tim Graham
3c1b572f18 Split model_fields tests into different files. 2016-03-23 19:31:47 -04:00
Simon Charette
0223e213dd Fixed #26186 -- Documented how app relative relationships of abstract models behave.
This partially reverts commit bc7d201bdb.

Thanks Tim for the review.

Refs #25858.
2016-02-29 22:07:05 -05:00
Hasan
3d0dcd7f5a Refs #26022 -- Used context manager version of assertRaises in tests. 2016-01-29 12:32:18 -05:00
Simon Charette
bc7d201bdb Fixed #25858 -- Bound abstract model application relative relationships.
Thanks to Karl Hobley for the report and Markus, Shai, Aymeric for their input
and Tim for the review.
2016-01-11 12:23:23 -05:00
Simon Charette
a08fda2111 Fixed #25746 -- Isolated inlined test models registration.
Thanks to Tim for the review.
2016-01-06 20:00:07 -05:00
Attila Tovt
6f229048dd Fixed #25547 -- Made Model.refresh_from_db() update FileField's instance. 2015-12-05 17:23:13 -05:00
George Marshall
710e11d076 Fixed #25767 -- Fixed data truncation possibility with Positive(Small)IntegerField on MySQL. 2015-11-24 11:09:15 -05:00
Alex Hill
134ca4d438 Fixed #24509 -- Added Expression support to SQLInsertCompiler 2015-09-22 23:35:24 +10:00
Iulia Chiriac
75ed590032 Fixed #24636 -- Added model field validation for decimal places and max digits. 2015-09-18 14:30:20 -04:00
Maxime Lorant
5153a3bfdc Fixed #25331 -- Removed trailing blank lines in docstrings. 2015-08-31 17:37:21 -04:00
Tim Graham
770449e24b Removed unused Field.get_flatchoices() method.
Unused since c2ba59fc1d (Django 1.0).

Thanks Andy Baker for the report.
2015-08-03 13:08:24 -04:00
Flavio Curella
c2e70f0265 Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField 2015-07-27 18:28:13 -04:00
Edward Henderson
f8cc464452 Fixed #16501 -- Added an allow_unicode parameter to SlugField.
Thanks Flavio Curella and Berker Peksag for the initial patch.
2015-07-17 13:48:58 -04:00
Tim Graham
47fcbe506c Fixed flake8 warnings on Python 3. 2015-06-15 11:27:09 -04:00
Rolo
19e67c6cd1 Fixed #24677 -- Made TextField.to_python() return a string.
This is consistent with CharField.
2015-06-04 09:02:54 -04:00
Jon Dufresne
44f3ee7716 Fixed #9596 -- Added date transform for DateTimeField. 2015-06-02 08:49:10 -04:00
Simon Charette
be67400b47 Refs #24652 -- Used SimpleTestCase where appropriate. 2015-05-20 13:46:13 -04:00
Alasdair Nicol
eaeea6f947 Fixed #24714 -- Used more specific assertions than assertEqual in tests. 2015-04-28 09:31:04 -04:00
Jon Dufresne
97bb48d9ba Fixed model_fields tests to use django TestCase. 2015-04-15 08:19:25 -04:00
Alex Hill
720ff740e7 Fixed #24215 -- Refactored lazy model operations
This adds a new method, Apps.lazy_model_operation(), and a helper function,
lazy_related_operation(), which together supersede add_lazy_relation() and
make lazy model operations the responsibility of the App registry. This
system no longer uses the class_prepared signal.
2015-03-25 16:48:17 -04:00
Anssi Kääriäinen
8f30556329 Renamed Field.rel attribute to remote_field
Field.rel is now deprecated. Rel objects have now also remote_field
attribute. This means that self == self.remote_field.remote_field.

In addition, made the Rel objects a bit more like Field objects. Still,
marked ManyToManyFields as null=True.
2015-03-25 08:16:12 -04:00
David Szotten
80e3444eca Fixed #24483 -- Prevented keepdb from breaking with generator choices.
If Field.choices is provided as an iterator, consume it in __init__ instead
of using itertools.tee (which ends up holding everything in memory
anyway). Fixes a bug where deconstruct() was consuming the iterator but
bypassing the call to `tee`.
2015-03-24 11:42:53 -04:00