Commit Graph

301 Commits

Author SHA1 Message Date
Simon Charette a82e21b0f9 Refs #18012 -- Removed the now unused proxied_children model option.
Thanks to Tim for the review.
2015-10-12 12:14:27 -04:00
Raphael Merx f5a33e4840 Fixed #25296 -- Prevented model related object cache pollution when create() fails due to an unsaved object. 2015-09-19 20:49:13 -04:00
Alex Hill 7bec480fe2 Fixed #24201 -- Added order_with_respect_to support to GenericForeignKey. 2015-08-27 09:20:17 -04:00
sarthakmeh 4bc00defd0 Fixed #14217 -- Added validation for field name collision when using model inheritance. 2015-08-25 16:16:54 -04:00
Tim Graham 5980b05c1f Fixed #25160 -- Moved unsaved model instance data loss check to Model.save()
This mostly reverts 5643a3b51b and
81e1a35c36.

Thanks Carl Meyer for review.
2015-08-10 08:51:32 -04:00
Flavio Curella c2e70f0265 Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField 2015-07-27 18:28:13 -04:00
Alexander Sosnovskiy 04e8d890ae Fixed #16891 -- Made Model/QuerySet.delete() return the number of deleted objects. 2015-05-22 13:27:16 -04:00
Luis Del Giudice 69ddc1b3da Fixed #24693 -- Added label and label_lower property to Model._meta 2015-05-02 16:58:18 +02:00
Tim Graham a10b4c010a Fixed #24578 -- Fixed crash with QuerySet.update() on FK to O2O fields.
Thanks Anssi Kääriäinen for review.
2015-04-09 06:50:21 -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
Anssi Kääriäinen f9c70bb3a1 Renamed ForeignObject.related_field to target_field 2015-03-25 08:13:27 -04:00
Jon Dufresne 966a29c2b8 Fixed #24479 -- Added system check to prevent both ordering and order_wrt. 2015-03-21 08:16:28 -04:00
Andriy Sokolovskiy 81c2d9f60b Fixed #15579 -- Added ability to delete only child models in multi-table inheritance. 2015-03-17 08:33:16 -04:00
Claude Paroz 5cf96b49e4 Fixed #24418 -- Prevented crash in refresh_from_db with null fk
Thanks Johannes Lerch for the report, Tim Graham for the test case,
and Simon Charette for the review.
2015-02-27 20:23:07 +01:00
Anssi Kääriäinen bad5f262bf Fixed #24328 -- cleaned up Options._get_fields() implementation 2015-02-20 13:00:12 -05:00
Loic Bistuer bed504d70b Fixed #24351, #24346 -- Changed the signature of allow_migrate().
The new signature enables better support for routing RunPython and
RunSQL operations, especially w.r.t. reusable and third-party apps.

This commit also takes advantage of the deprecation cycle for the old
signature to remove the backward incompatibility introduced in #22583;
RunPython and RunSQL won't call allow_migrate() when when the router
has the old signature.

Thanks Aymeric Augustin and Tim Graham for helping shape up the patch.

Refs 22583.
2015-02-20 21:34:09 +07:00
Aymeric Augustin 1b8af4cfa0 Disallowed importing concrete models without an application.
Removed fragile algorithm to find which application a model belongs to.

Fixed #21680, #21719. Refs #21794.
2015-02-10 21:41:19 +01:00
Tim Graham e144e0e237 Removed unnecessary parentheses in model check messages. 2015-02-09 08:53:58 -05:00
Aron Podrigal 4d73303ee9 Fixed #24249 -- Improved field shadowing validation in model multi-inheritance. 2015-02-09 08:37:55 -05:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Aron Podrigal 79f27f2b61 Fixed #15321 -- Honored ancestors unique checks.
Thanks to Tim for the review.
2015-02-03 18:56:53 -05:00
Anssi Kääriäinen 8adc59038c Fixed #23617 -- Added get_pk_value_on_save()
The method is mainly intended for use with UUIDField. For UUIDField we
want to call the field's default even when primary key value is
explicitly set to None to match the behavior of AutoField.

Thanks to Marc Tamlyn and Tim Graham for review.
2015-02-03 09:23:44 -05:00
Tim Graham 378a0d27d6 Advanced deprecation warnings for Django 1.9. 2015-01-19 12:22:41 -05:00
Daniel Pyrathon fb48eb0581 Fixed #12663 -- Formalized the Model._meta API for retrieving fields.
Thanks to Russell Keith-Magee for mentoring this Google Summer of
Code 2014 project and everyone else who helped with the patch!
2015-01-06 19:25:12 -05:00
Daniel Pyrathon 8958170755 Fixed #9104 -- Moved FieldDoesNotExist to core.exceptions 2015-01-02 10:46:04 -05:00
Claude Paroz 108b8bf852 Fixed #24007 -- Ensure apps registry's ready before unpickling models
This prevents AppRegistryNotReady errors when unpickling Django
models from an external script.
2014-12-17 18:33:32 +01:00
Markus Holtermann e37ab311fc Changed internal storing of abstract and concrete managers to be in a single list.
This commit prepares the internal manager layout to be serialized by
migrations; refs #23822.
2014-12-15 08:32:47 -05:00
Anssi Kääriäinen c7175fcdfe Fixed #901 -- Added Model.refresh_from_db() method
Thanks to github aliases dbrgn, carljm, slurms, dfunckt, and timgraham
for reviews.
2014-11-28 06:54:00 -05:00
Carl Meyer e7b9a58b08 Fixed #21794 -- Removed deprecation warning for abstract models outside an app. 2014-11-19 15:56:04 -07:00
Karen Tracey dec93d8991 Fixed #21612 -- Made QuerySet.update() respect to_field 2014-11-16 15:44:13 +01:00
Jozef Knaperek c56c42b5c0 Fixed #22967 -- Made Model._do_update consistent
Made _do_update behave more strictly according to its docs,
including a corner case when specific concurent updates are
executed and select_on_save is set.
2014-11-12 12:53:30 +02:00
Tim Graham c32bc1a7a7 Fixed #11775 -- Made ABSOLUTE_URL_OVERRIDES work with models that don't define get_absolute_url().
Thanks jukvalim for the report and initial patch,
and Preston Timmons for review.
2014-09-09 11:05:31 -04:00
Tim Graham 1101467ce0 Limited lines to 119 characters in django/
refs #23395.
2014-09-05 09:22:16 -04:00
Shai Berger dd9b3312d0 Fixed name of database connection feature 2014-07-14 19:23:57 +03:00
Anssi Kääriäinen 0b6f05ede6 Fixed #19501 -- added Model.from_db() method
The Model.from_db() is intended to be used in cases where customization
of model loading is needed. Reasons can be performance, or adding custom
behavior to the model (for example "dirty field tracking" to issue
automatic update_fields when saving models).

A big thank you to Tim Graham for the review!
2014-07-01 16:31:01 +03:00
Anubhav Joshi 1c50d6ae2b Fixed problem introduced with #refs 13711. 2014-06-23 19:36:40 +03:00
Anubhav Joshi 91f1b6dcdc Fixed #13711 -- Model check added to ensure that auto-generated column name is within limits of the database.
Thanks russellm for report and Tim Graham for review.
2014-06-17 16:16:02 -04:00
Anubhav Joshi 42736ac8e8 Fixed #21430 -- Added a RuntimeWarning when unpickling Models and QuerySets from a different Django version.
Thanks FunkyBob for the suggestion, prasoon2211 for the initial patch,
and akaariai, loic, and charettes for helping in shaping the patch.
2014-06-11 10:03:34 -04:00
Craig de Stigter ce993efda8 Fixed #22690 -- Added a check for proxy models containing fields.
Removed the FieldError raised by ModelBase.__new__ in this case.
2014-06-02 09:32:38 -04:00
Vincent-Vega d04e730224 Fixed #22711 -- Adjusted ordering checks to allow implicit relation fields.
refs #19195.
2014-06-01 15:36:25 -04:00
Tim Graham 1efb2e73bf Fixed typo. 2014-05-16 16:39:12 -04:00
Vlad Starostin 1be03aff5c Fixed #18389 -- Fixed the way contribute_to_class is called
Now this method is only called only if the object is an instance.
This allows to have field classes as model class attributes.
2014-05-16 10:40:07 -04:00
Yehonatan Daniv e2e4cdba11 Fixed #22539 -- Copied exclude argument in Model.full_clean() to prevent side effects. 2014-05-01 09:28:11 -04:00
Simon Charette a2340ac6d6 Use the new implementation of `six.with_metaclass`.
No more `NewBase` horrors.

Thanks to bendavis78 for his work on merging this into six.
2014-04-29 09:43:08 -04:00
Aymeric Augustin 428c0bbe1b Appeased flake8 2.1.0. 2014-04-21 12:27:34 +02:00
Marc Egli 0bcc92c691 Fixed #22356 -- Added a check to make sure unique_together fields are local. 2014-04-14 16:49:40 -04:00
Claude Paroz 0a65da941c Fixed #22236 -- Removed inappropriate usage of signals
Thanks Aymeric Augustin for the report and Tim Graham for the review.
2014-04-05 21:00:31 +02:00
Aymeric Augustin 0f9560855e Removed legacy transaction management per the deprecation timeline. 2014-03-21 21:06:50 +01:00
Claude Paroz 210d0489c5 Fixed #21188 -- Introduced subclasses for to-be-removed-in-django-XX warnings
Thanks Anssi Kääriäinen for the idea and Simon Charette for the
review.
2014-03-08 09:57:40 +01:00