summaryrefslogtreecommitdiff
path: root/tests/migrations/test_state.py
AgeCommit message (Collapse)Author
2025-07-23Refs #36500 -- Rewrapped long docstrings and block comments via a script.django-bot
Rewrapped long docstrings and block comments to 79 characters + newline using script from https://github.com/medmunds/autofix-w505.
2024-11-29Fixed #373 -- Added CompositePrimaryKey.Bendeguz Csirmaz
Thanks Lily Foote and Simon Charette for reviews and mentoring this Google Summer of Code 2024 project. Co-authored-by: Simon Charette <charette.s@gmail.com> Co-authored-by: Lily Foote <code@lilyf.org>
2024-07-10Fixed #35424 -- Checked order_with_respect_to is available when migrating ↵Daniel Patrick
_order fields. Migrations would crash following the removal of an order_with_respect_to field from a model and the addition of an _order field.
2024-03-22Added ModelState.from_model() test for abstract model with unnamed indexes.Mariusz Felisiak
2024-03-01Refs #35234 -- Deprecated CheckConstraint.check in favor of .condition.Simon Charette
Once the deprecation period ends CheckConstraint.check() can become the documented method that performs system checks for BaseConstraint subclasses.
2023-11-23Fixed #26827 -- Improved ModelState error message when relations refer model ↵Prashant Pandey
classes.
2023-09-18Refs #27236 -- Removed Meta.index_together per deprecation timeline.Mariusz Felisiak
2023-02-01Refs #33476 -- Applied Black's 2023 stable style.David Smith
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
2022-07-12Fixed #27236 -- Deprecated Meta.index_together in favor of Meta.indexes.David Wobrock
This also deprecates AlterIndexTogether migration operation.
2022-02-07Refs #33476 -- Refactored code to strictly match 88 characters line length.Mariusz Felisiak
2022-02-07Refs #33476 -- Reformatted code with Black.django-bot
2022-01-21Fixed #33449 -- Fixed makemigrations crash on models without ↵Fabian Büchler
Meta.order_with_respect_to but with _order field. Regression in aa4acc164d1247c0de515c959f7b09648b57dc42.
2021-08-26Refs #29898 -- Changed fields in ProjectState's relation registry to dict.Mariusz Felisiak
2021-08-25Refs #29898 -- Made ProjectState encapsulate alterations in relations registry.Manav Agarwal
Thanks Simon Charette and Chris Jerdonek for reviews. Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2021-08-19Fixed #33014 -- Made ProjectState raise exception when real_apps argument is ↵Chris Jerdonek
not a set.
2021-08-11Refs #29898 -- Changed ProjectState.real_apps to set.Mariusz Felisiak
2021-07-27Refs #32956 -- Changed "afterwards" to "afterward" in docs and comments.David Smith
This also removes unnecessary comments with the previous spelling. AP Stylebook has a short entry to advise the preferred spelling for "en-us". "Afterwards" is preferred in British English.
2021-06-07Fixed typos in test comments.luzpaz
2021-02-19Fixed #32458 -- Made __repr__() for Index and BaseConstraint subclasses more ↵Hannes Ljungberg
consistent.
2020-06-26Fixed #31742 -- Fixed makemigrations crash on ForeignKey to an app with ↵Mariusz Felisiak
mixed case label. Regression in 9e1b6b8a66af4c2197e5b1b41eb9dbb36e4f6502. Thanks Ignacio Santolin for the report.
2020-04-22Fixed #31499 -- Stored ModelState.fields into a dict.Simon Charette
This allows the removal of its O(n) .get_field_by_name method and many other awkward access patterns. While fields were initially stored in a list to preserve the initial model definiton field ordering the auto-detector doesn't take field ordering into account and no operations exists to reorder fields of a model. This makes the preservation of the field ordering completely superflous because field reorganization after the creation of the model state wouldn't be taken into account.
2020-04-22Refs #31499 -- Ignored field ordering to determine ModelState equality.Simon Charette
2020-04-08Refs #30966 -- Added test for reloading related model state on ↵Mariusz Felisiak
non-relational changes. Thanks Markus Holtermann for initial test. Fixed in 1d16c5d562a67625f7309cc7765b8c57d49bf182.
2020-04-07Refs #27666 -- Ensured relationship consistency on delayed reloads.Simon Charette
Delayed reloads of state models broke identity based relationships between direct and non-direct ancestors. Basing models.Options related objects map of model labels instead of their identity ensured relationship consistency is maintained. Refs #30966. Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2020-01-16Fixed #29998 -- Allowed multiple OneToOneFields to the parent model.Mariusz Felisiak
We assumed that any OneToOneField's in a child model must be the parent link and raised an error when parent_link=True was not specified. This patch allows to specify multiple OneToOneField's to the parent model. OneToOneField's without a custom related_name will raise fields.E304 and fields.E305 so this should warn users when they try to override the auto-created OneToOneField.
2019-11-18Removed unnecessary parentheses in various code.Jon Dufresne
2019-10-29Used more specific unittest assertions in tests.Nick Pope
* assertIsNone()/assertIsNotNone() instead of comparing to None. * assertLess() for < comparisons. * assertIs() for 'is' expressions. * assertIsInstance() for isinstance() expressions. * rounding of assertAlmostEqual() for round() expressions. * assertIs(..., True/False) instead of comparing to True/False. * assertIs()/assertIsNot() for ==/!= comparisons. * assertNotEqual() for == comparisons. * assertTrue()/assertFalse() instead of comparing to True/False.
2019-07-08Changed django.db.models.indexes.Index imports to django.db.models.Index.Mariusz Felisiak
2018-10-02Refs #11964 -- Changed CheckConstraint() signature to use keyword-only ↵Simon Charette
arguments. Also renamed the `constraint` argument to `check` to better represent which part of the constraint the provided `Q` object represents.
2018-07-10Fixed #11964 -- Added support for database check constraints.Ian Foote
2017-12-28Removed unnecessary trailing commas and spaces in various code.Mariusz Felisiak
2017-06-01Refs #23968 -- Removed unnecessary lists, generators, and tuple calls.Jon Dufresne
2017-04-10Refs #26605 -- Isolated a migrations state test.Tim Graham
2017-04-07Refs #26605 -- Added migrations state test for a swappable model inheriting ↵Ingo Klöcker
an abstract model inheriting concrete model. Thanks Sébastien Diemer for the report and test.
2017-04-07Fixed #28051 -- Made migrations respect Index's name argument.Markus Holtermann
Thanks Marc Tamlyn for the report and Tim Graham for the review.
2017-03-21Fixed #27915 -- Allowed Meta.indexes to be defined in abstract models.Tim Graham
Thanks Markus Holtermann for review.
2017-03-04Refs #27795 -- Removed unneeded force_text callsClaude Paroz
Thanks Tim Graham for the review.
2017-01-19Refs #23919 -- Removed str() conversion of type and method __name__.Simon Charette
2017-01-18Refs #23919 -- Removed six.<various>_types usageClaude Paroz
Thanks Tim Graham and Simon Charette for the reviews.
2016-11-10Refs #27392 -- Removed "Tests that", "Ensures that", etc. from test docstrings.za
2016-08-05Fixed #26808 -- Added Meta.indexes for class-based indexes.Akshesh
* Added the index name to its deconstruction. * Added indexes to sqlite3.schema._remake_table() so that indexes aren't dropped when _remake_table() is called. Thanks timgraham & MarkusH for review and advice.
2016-07-09Fixed #26881 -- Fixed duplicate managers in migrations.Loïc Bistuer
When both parent and child models had managers with the same name and a migrations opt-in both were added to the migration state.
2016-06-27Fixed #26709 -- Added class-based indexes.Akshesh
Added the AddIndex and RemoveIndex operations to use them in migrations. Thanks markush, mjtamlyn, timgraham, and charettes for review and advice.
2016-06-20Fixed #26643 -- Prevented unnecessary AlterModelManagers operations caused ↵Loïc Bistuer
by the manager inheritance refactor. This also makes migrations respect the base_manager_name and default_manager_name model options. Thanks Anthony King and Matthew Schinckel for the initial patches.
2016-06-16Fixed #26747 -- Used more specific assertions in the Django test suite.Jon Dufresne
2016-05-19Refs #26421 -- Refactored Apps.lazy_model_operation() for better checks and ↵Alex Hill
tests
2016-05-17Fixed #20932, #25897 -- Streamlined manager inheritance.Loïc Bistuer
2016-05-13Refs #24201 -- Ignored order_with_respect_to private fields in migrations.Simon Charette
Thanks Tim for the review.
2016-04-08Fixed E128 flake8 warnings in tests/.Tim Graham
2015-10-19Refs #18012 -- Accounted for reverse proxy relations in migrations.Simon Charette
Thanks to Markus for the suggestion and Tim for the review.