Commit Graph

46 Commits

Author SHA1 Message Date
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
Mariusz Felisiak 1e2e1be02b
Fixed #33515 -- Prevented recreation of migration for ManyToManyField to lowercased swappable setting.
Thanks Chris Lee for the report.

Regression in 4328970780.

Refs #23916.
2022-02-16 21:09:24 +01:00
django-bot 9c19aff7c7 Refs #33476 -- Reformatted code with Black. 2022-02-07 20:37:05 +01:00
Simon Charette 4328970780 Fixed #33366 -- Fixed case handling with swappable setting detection in migrations autodetector.
The migration framework uniquely identifies models by case insensitive
labels composed of their app label and model names and so does the app
registry in most of its methods (e.g. AppConfig.get_model) but it
wasn't the case for get_swappable_settings_name() until this change.

This likely slipped under the radar for so long and only regressed in
b9df2b74b9 because prior to the changes
related to the usage of model states instead of rendered models in the
auto-detector the exact value settings value was never going through a
case folding hoop.

Thanks Andrew Chen Wang for the report and Keryn Knight for the
investigation.
2021-12-17 07:46:58 +01:00
Nick Touran 1fb21ab377 Refs #32983 -- Removed unneeded related_name from test model definitions. 2021-08-06 11:57:02 +02:00
David Wobrock b9df2b74b9 Fixed #32676 -- Prevented migrations from rendering related field attributes when not passed during initialization.
Thanks Simon Charette for the implementation idea.
2021-05-28 20:25:59 +02:00
Mariusz Felisiak d992f4e3c2 Refs #31369 -- Removed models.NullBooleanField per deprecation timeline. 2021-01-14 17:50:04 +01:00
Adam Johnson 9e1b6b8a66 Fixed #23916 -- Allowed makemigrations to handle related model name case changes.
Made autodetector ignore related model name case changes so unnecessary
migrations are not created.
2020-03-25 10:39:34 +01:00
Caio Ariede 555bebe774 Fixed #30987 -- Added models.PositiveBigIntegerField. 2019-11-19 09:34:11 +01:00
Cameron Curry 622ead6aaf Fixed #28937 -- Allowed BinaryField to be editable=True. 2017-12-22 16:31:46 -05:00
Simon Charette c466ef3b34 Tested field deconstruction with DEFAULT_DB_TABLESPACE and db_tablespace. 2017-09-11 12:20:45 -04:00
Adam Bogdał bd0c9388c0 Added additional field_construction tests for related fields. 2017-06-14 08:57:43 -04:00
Adam Bogdał cd2fe829dd Fixed #24195 -- Deconstructed the limit_choices_to option of related fields.
Migrations will now be created for changes to limit_choices_to.
2017-06-14 08:57:24 -04:00
Claude Paroz 7b2f2e74ad Refs #23919 -- Removed six.<various>_types usage
Thanks Tim Graham and Simon Charette for the reviews.
2017-01-18 20:18:46 +01:00
Claude Paroz d7b9aaa366 Refs #23919 -- Removed encoding preambles and future imports 2017-01-18 09:55:19 +01:00
Tim Graham 8119b679eb Refs #27025 -- Fixed "invalid escape sequence" warnings in Python 3.6.
http://bugs.python.org/issue27364
2016-09-17 15:44:06 -04:00
Markus Holtermann 8e631a3175 Refs #24590 -- Ensured isolation between autodetector tests
Fixed a regression introduced in e1427cc609 when running tests in reverse order.
2015-08-28 10:17:34 +10:00
Markus Holtermann e1427cc609 Fixed #24590 -- Cached calls to swappable_setting.
Moved the lookup in Field.swappable_setting to Apps, and added
an lru_cache to cache the results.

Refs #24743

Thanks Marten Kenbeek for the initial work on the patch. Thanks Aymeric
Augustin and Tim Graham for the review.
2015-08-27 17:06:21 +10:00
Flavio Curella c2e70f0265 Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField 2015-07-27 18:28:13 -04:00
Simon Charette be67400b47 Refs #24652 -- Used SimpleTestCase where appropriate. 2015-05-20 13:46:13 -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
Tim Graham b4a56ed4f5 Refs #24483 -- Added a test for deconstruction of Field.choices 2015-03-18 13:39:52 -04:00
Claude Paroz 51890ce889 Applied ignore_warnings to Django tests 2014-12-30 18:16:25 +01:00
Carl Meyer 8aaf51f94c Revert "Fixed #23455 -- Forced related_name to be a unicode string during deconstruction."
This reverts commit 45bd7b3bd9.
2014-12-12 12:50:39 -07:00
Markus Holtermann 45bd7b3bd9 Fixed #23455 -- Forced related_name to be a unicode string during deconstruction. 2014-09-25 17:49:44 -04:00
Andrew Godwin 4d2f9c38e8 Fixed #23288: deconstruct() ignoring related_name 2014-08-14 19:47:22 -07:00
Baptiste Mispelon 7432533932 Added missing logic to TimeField.deconstruct().
If auto_now or auto_now_add was used then the serialized
field in the migration contained unnecessary `editable` and
`blank` arguments.
2014-08-03 14:02:21 +02:00
Baptiste Mispelon 72f1eb48df Fixed #23156 -- Added missing BinaryField.deconstruct() method. 2014-08-03 13:02:31 +02:00
Abraham Martin e1347e9253 Fixed #23101 db_table wasn't copied in deconstruct
Forward port of 999758fc7a from
stable/1.7.x
2014-07-26 10:00:02 -07:00
Tim Graham 7fd55c3481 Fixed #20631 -- Increased the default EmailField max_length to 254.
Thanks pmartin for the report.
2014-07-04 14:15:00 -04:00
Andrew Godwin 0b571753a8 Fixed #22889: Unneeded to_field in fk.deconstruct causing swap issues 2014-06-23 20:39:17 -07:00
Aymeric Augustin b1432bfc22 Appeased flake8. 2014-05-08 21:49:54 +02:00
Andrew Godwin 6944418277 Fixed #22337: FileSystemStorage marked as deconstructible and tested. 2014-05-06 22:23:23 -07:00
Claude Paroz da9cf53cb5 Fixed #22564 -- Prevented unneeded bytestrings in migrations
In some cases, this could lead to migrations written with Python 2
being incompatible with Python 3.
Thanks Tim Graham for the report and Loïc Bistuer for the advices.
2014-05-06 09:13:07 +02:00
Alex Gaynor 2bcb8bfc8d Fix many many typos in comments throughout the codebase 2014-04-26 10:18:45 -07:00
Baptiste Mispelon 37f7f233f5 Fixed #22272 -- Fixed regression in DecimalField when using decimal_places=0.
Thanks to trac user merb for the report.
2014-03-14 17:21:59 +01:00
Alex Gaynor add1584bfa 4 flake8 warning fixes 2014-03-08 16:17:54 -08:00
Andrew Godwin 6b07804474 Fixed #22183: Through M2Ms now correctly handled 2014-03-08 15:58:04 -08:00
Andrew Godwin cd7a2a077e Fixed #22199: Bad max_length deconstruction for FileField 2014-03-08 13:59:12 -08:00
Andrew Godwin c9de1b4a55 Implement swappable model support for migrations 2014-01-19 16:43:12 +00:00
Andrew Godwin 86e69bf3b6 Fixed #21785: Bad handling of both auto_now and _add on deconstruct 2014-01-17 10:46:03 +00:00
Aymeric Augustin 6e895f9e06 Removed superfluous models.py files.
Added comments in the three empty models.py files that are still needed.

Adjusted the test runner to add applications corresponding to test
labels to INSTALLED_APPS even when they don't have a models module.
2013-12-17 11:16:48 +01:00
Tim Graham 96d1d4e292 Removed unused local variables in tests. 2013-10-19 08:31:38 -04:00
Erik Romijn 1a63092981 Fixed #20439 -- Started deprecation of IPAddressField 2013-09-28 10:55:32 +02:00
Andrew Godwin 48dd1e63bb Ported over Field.deconstruct() from my schema alteration branch.
This is to help other ongoing branches which would benefit from
this functionality.
2013-06-28 17:27:52 +01:00