Commit Graph

382 Commits

Author SHA1 Message Date
Tim Graham e7185a6514 Refs #29516 -- Reverted inadvertent change in Model.__init__(). 2018-06-25 09:39:16 -04:00
Federico Bond 4c36414323 Fixed #29517 -- Rephrased error message when passing incorrect kwarg to model constructor 2018-06-25 09:30:58 +02:00
Carlton Gibson 21fd8041c1
Refs #29358 -- Corrected wording in primary key check message. 2018-05-03 15:28:37 +02:00
Hasan Ramezani 816b8d9518 Fixed #29358 -- Added a system check to prohibit models with more than one primary_key field. 2018-05-03 09:08:29 +02:00
robwa 4ab027b944 Fixed #28988 -- Fixed queries when a GenericRelation is used with multi-table inheritance. 2018-03-12 22:42:48 -04:00
Дилян Палаузов f427ffcccb Fixed #29093 -- Simplified a few lines in ModelBase.__new__(). 2018-01-31 10:22:56 -05:00
Jon Dufresne 136bf5c214 Fixed #29076 -- Made Model.refresh_from_db() clear cached relationships even if the related id doesn't change. 2018-01-30 10:43:53 -05:00
Дилян Палаузов d7b2aa24f7 Fixed #28982 -- Simplified code with and/or. 2018-01-03 20:12:23 -05:00
shanghui cc6bcc6ff5 Fixed #28867 -- Added system check for a model property that clashes with a related field accessor. 2018-01-03 10:34:31 -05:00
Simon Charette f5a989e603 Fixed #28974 -- Made refresh_from_db() hint routers about its instance. 2018-01-02 09:42:24 -05:00
Tim Graham d065c92678
Fixed #28918 -- Fixed Model.refresh_from_db() for instances hidden by the default manager. 2017-12-30 18:00:36 -05:00
hui shang f1aa58479c Fixed #28714 -- Added system checks for invalid model field names in Meta.indexes.
Thanks Gabriel for the report and Adam Johnson for the review.
2017-12-27 18:56:24 -05:00
Дилян Палаузов 4c599ece57 Fixed #28930 -- Simplified code with any() and all(). 2017-12-26 17:11:15 -05:00
Nick Pope d13a9e44de Fixed #28909 -- Simplified code using tuple/list/set/dict unpacking. 2017-12-11 07:08:45 -05:00
Дилян Палаузов d2afa5eb23 Fixed #28860 -- Removed unnecessary len() calls. 2017-12-04 10:35:23 -05:00
Paulo ee49306176 Fixed #27710 -- Made Model.save() invalidate cached, stale relations after a primary key assignment. 2017-11-09 11:40:34 -05:00
k 399a8db33b Fixed #28695 -- Allowed models to use __init_subclass__(). 2017-10-13 21:29:12 -04:00
Simon Charette 216eda103b Refs #28575 -- Removed unnecessary code for model exception pickling.
Setting __qualname__ is sufficient for pickling of DoesNotExist and
and MultipleObjectsReturned to work correctly.
2017-10-13 15:45:12 -04:00
Rachel Tobin 6c92f711ea Refs #28575 -- Allowed pickling Model.DoesNotExist and MultipleObjectsReturned classes. 2017-10-13 09:16:09 -04:00
Paulo a7b5ad8b19 Fixed #27846 -- Made Model.refresh_from_db() clear cached relations. 2017-10-12 17:04:10 -04:00
Mariusz Felisiak fb02ebe889 Fixed #28597 -- Fixed crash with the name of a model's autogenerated primary key in an Index's fields. 2017-09-18 14:06:00 -04:00
Sergey Fedoseev 5b1c389603 Refs #23919 -- Replaced usage of django.utils.functional.curry() with functools.partial()/partialmethod(). 2017-09-06 13:11:18 -04:00
Dima Kudosh 093fd479d6 Fixed #28335 -- Allowed query expressions in Meta.ordering. 2017-09-05 19:10:20 -04:00
Sergey Fedoseev 5cc7462067 Refs #28459 -- Optimized ModelState instantiation. 2017-08-11 15:41:04 -04:00
Nerl~ 97cb3bd16d Fixed #28456 -- Allowed customizing Model pickling by overriding __getstate__(). 2017-08-11 15:27:25 -04:00
Paulo bfb746f983 Refs #16043 -- Refactored internal fields value cache.
* Removed all hardcoded logic for _{fieldname}_cache.
* Added an internal API for interacting with the field values cache.

Thanks carljm and MarkusH for support.
2017-08-10 12:06:02 -04:00
Sergey Fedoseev 78f7f68021 Refs #28459 -- Improved performance of Model.from_db() when fields are deferred. 2017-08-02 09:16:36 -04:00
Sergey Fedoseev aadd3aeb2b Avoided creating temporary lists for obtaining the first item. 2017-07-31 11:02:23 -04:00
Tim Graham 3d0a0ecd2c Refs #23919 -- Removed support for broken Model.__str__() in Model.__repr__().
Returning invalid bytestrings in __str__() is unlikely in Python 3.
2017-06-11 15:52:19 -04:00
Collin Anderson 1a49b89470 Fixed #27953 -- Added instance's pk to Model.__str__(). 2017-06-09 13:42:53 -04:00
Jon Dufresne 0c3c37a376 Fixed #28282 -- Fixed class-based indexes name for models that only inherit Model. 2017-06-08 09:36:12 -04:00
Tim Graham 5a52d932ef Replaced Model._get_pk_val() with pk property.
Model.pk was added after _get_pk_val() and many places weren't simplified.
2017-06-05 15:20:34 -04:00
Jon Dufresne 2c69824e5a Refs #23968 -- Removed unnecessary lists, generators, and tuple calls. 2017-06-01 19:08:59 -04:00
Jon Dufresne 21046e7773 Fixed #28249 -- Removed unnecessary dict.keys() calls.
iter(dict) is equivalent to iter(dict.keys()).
2017-05-27 19:08:46 -04:00
Jon Dufresne 7be94e0335 Replaced set |= operator with update() to avoid temporary set. 2017-04-27 08:16:19 -04:00
Tim Graham 3d19d1428a Fixed #27915 -- Allowed Meta.indexes to be defined in abstract models.
Thanks Markus Holtermann for review.
2017-03-21 10:53:21 -04:00
Claude Paroz 8346680e1c Refs #27795 -- Removed unneeded force_text calls
Thanks Tim Graham for the review.
2017-03-04 18:18:21 +01:00
Anton Samarchyan 60e52a047e Refs #27656 -- Updated django.db docstring verbs according to PEP 257. 2017-02-28 09:17:27 -05:00
Claude Paroz c651331b34 Converted usage of ugettext* functions to their gettext* aliases
Thanks Tim Graham for the review.
2017-02-07 09:04:04 +01:00
Tim Graham 29f607927f Fixed spelling of "nonexistent". 2017-02-03 08:01:45 -05:00
chillaranand d6eaf7c018 Refs #23919 -- Replaced super(ClassName, self) with super(). 2017-01-25 12:23:46 -05:00
Claude Paroz 042b7350a0 Refs #23919 -- Removed unneeded str() calls 2017-01-20 14:13:55 +01:00
Claude Paroz dc8834cad4 Refs #23919 -- Removed unneeded force_str calls 2017-01-20 08:44:31 +01:00
Simon Charette cecc079168 Refs #23919 -- Stopped inheriting from object to define new style classes. 2017-01-19 08:39:46 +01:00
Aymeric Augustin eb422e476f Refs #23919 -- Removed obsolete __ne__() methods.
__ne__() defaults to the opposite of __eq__() on Python 3
when it doesn't return NotImplemented.
2017-01-18 21:44:00 -05:00
Claude Paroz 2b281cc35e Refs #23919 -- Removed most of remaining six usage
Thanks Tim Graham for the review.
2017-01-18 21:33:28 +01: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 c716fe8782 Refs #23919 -- Removed six.PY2/PY3 usage
Thanks Tim Graham for the review.
2017-01-18 16:21:28 +01:00
Claude Paroz f3c43ad1fd Refs #23919 -- Removed python_2_unicode_compatible decorator usage 2017-01-18 13:44:34 +01:00
Claude Paroz d7b9aaa366 Refs #23919 -- Removed encoding preambles and future imports 2017-01-18 09:55:19 +01:00