Commit graph

869 commits

Author SHA1 Message Date
Hasan Ramezani
2269f810c8 Fix TypeError in save when model inherits from both TimeStampModel and StatusModel. (Fixes GH-465) 2020-12-02 00:07:22 +01:00
David Smith
79ff8ea6be
Used isort to sort imports (#460) 2020-11-29 20:58:00 +00:00
Simon Charette
b0be6e2422 Adjust CHANGES to mention 4.1.0 release and add missing changes. 2020-11-29 09:42:26 -05:00
Jannis Leidel
1b3ebb7fc2
Merge pull request #462 from jazzband/gha
Migrate to GitHub Actions
2020-11-29 15:37:15 +01:00
Jannis Leidel
382110f84c
Update .github/workflows/test.yml
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2020-11-29 15:34:22 +01:00
Jannis Leidel
8689faf2ad
Update tox.ini
Co-authored-by: Simon Charette <charettes@users.noreply.github.com>
2020-11-29 15:12:19 +01:00
Jannis Leidel
e630935fa3
Please coverage 2020-11-29 15:00:33 +01:00
Jannis Leidel
415742ccdf
Fix typo. 2020-11-29 14:54:45 +01:00
Jannis Leidel
124ca26901
Remove duplicate version mapping. 2020-11-29 14:54:15 +01:00
Jannis Leidel
e2e2cc8485
Remove old Travis cruft. 2020-11-29 14:53:56 +01:00
Jannis Leidel
1b9e1fa435
Update changelog. 2020-11-29 14:53:42 +01:00
Jannis Leidel
5b3672b980
Run Postgres 10 during testing. 2020-11-29 14:51:26 +01:00
Jannis Leidel
24c196ebe3
Fix typo. 2020-11-29 14:44:11 +01:00
Jannis Leidel
1336a91d75
Merge branch 'master' into gha 2020-11-29 14:42:23 +01:00
Jannis Leidel
ec7ef185fb
Add release workflow. 2020-11-29 14:40:18 +01:00
Jannis Leidel
c3f25724f4
Ignore coverage xml. 2020-11-29 14:40:07 +01:00
Jannis Leidel
000528d8d8
Remove old Mercurial cruft. 2020-11-29 14:39:53 +01:00
Jannis Leidel
2cd07a9e89
Use setuptools_scm 2020-11-29 14:39:17 +01:00
Jannis Leidel
0ce2501384
Update tox config. 2020-11-29 14:36:06 +01:00
Jannis Leidel
7121e9575a
Add GitHub Actions test workflow. 2020-11-29 14:35:54 +01:00
Hasan Ramezani
775ac3f4b1 Add flake8 to travisci. 2020-11-29 13:36:33 +01:00
Hasan Ramezani
4ec3ecdade Fix flake8 errors. 2020-11-29 13:36:33 +01:00
Hasan Ramezani
020e7c4da8 Improve tox.ini 2020-11-29 13:36:33 +01:00
David Smith
6a4b44b5c3 Removed universal wheel builds
No longer required as Python 2 support is deprecated
2020-11-29 16:24:17 +06:00
Hasan Ramezani
882919f7e0 Add Python3.9 support. 2020-11-28 21:47:15 +01:00
Hasan Ramezani
5580cad525 Remove Django 2.1 support. 2020-11-28 21:47:15 +01:00
Hasan Ramezani
a28b7afd31 Added Python and Django supported versions to README.rst 2020-11-28 21:46:47 +01:00
Hasan Ramezani
92ff6b927f Remove codes related to old versions of Django. 2020-11-28 21:46:25 +01:00
Hasan Ramezani
79cbc96055 Replace ugettext_lazy with gettext_lazy in test models to satisfy Django deprecation warning. 2020-11-28 19:26:34 +01:00
Hasan Ramezani
9faaf760d3
Merge pull request #455 from bensteinberg/fix-typo
Fix typo in model_utils.tracker
2020-10-29 22:06:36 +01:00
Ben Steinberg
eba26d6bd4 Fix typo 2020-10-29 09:11:30 -04:00
Arseniy Panfilov
b302580283 use empty set instead of a dict for an 'empty set' test case 2020-10-15 15:51:33 +06:00
Arseniy Panfilov
e9c45c71d1 update implementation of TimeStampedModel.save to handle various ways of specifying 'update_fields' 2020-10-15 15:51:33 +06:00
Arseniy Panfilov
fdd3af34d9 failing tests with different types of arguments for 'updated_fields' 2020-10-15 15:51:33 +06:00
kishorkunal-raj
1b3f7d6262 Adding ppc64le architecture support on travis-ci 2020-10-15 15:49:11 +06:00
Hasan Ramezani
be1c0f571e Add farsi translation. 2020-09-23 09:29:26 +06:00
Hasan Ramezani
94db7b06e6 Replace deprecated django-admin.py with django-admin in CONTRIBUTING.rst 2020-09-23 09:29:26 +06:00
Hasan Ramezani
fed287e6fb Update test requirements. 2020-09-17 20:44:42 +06:00
H. Buğra Aydın
2ad67e77b1
Add status_changed field to upload_fields parameter during save if status field is present (#441)
* implementation/tests

* naming problem
2020-09-17 20:34:57 +06:00
Hasan Ramezani
b7770165d5 Add support for Django 3.1 2020-09-17 17:27:55 +06:00
Craig Anderson
b7a160936f Add available_objects soft deletable model manager. Emit deprecation warning when using objects soft deletable manager. 2020-08-25 16:40:09 +06:00
Craig Anderson
eb00f65c81 Change assert calls to avoid deprecation warnings. 2020-08-12 16:33:07 +06:00
Skia
33e46ebd53 managers: avoid querying too much tables when not needed
When calling `select_related()` with an empty list of arguments [1], Django will
try to prefetch some data by doing some first level joints with the related
classes.
This can lead to obvious negative performance impact, but this also breaks some
workarounds for having inheritance for foreign keys [2], as those solutions rely
on lazy evaluation of the related object.

[1]: a4e6030904/django/db/models/query.py (L1051)
     Only passing an explicit `None` to `select_related` will disable the magic.
[2]: https://github.com/jazzband/django-model-utils/issues/11

As examples, here are the generated SQL requests in
InheritanceManagerRelatedTests.test_get_method_with_select_subclasses_check_for_useless_join:

  * without this fix, without adding `.select_related(None)`
```sql
SELECT
    "tests_inheritancemanagertestparent"."id",
    "tests_inheritancemanagertestparent"."non_related_field_using_descriptor",
    "tests_inheritancemanagertestparent"."related_id",
    "tests_inheritancemanagertestparent"."normal_field",
    "tests_inheritancemanagertestparent"."related_self_id",
    "tests_inheritancemanagertestchild4"."other_onetoone_id",
    "tests_inheritancemanagertestchild4"."parent_ptr_id", T3."id",
    T3."non_related_field_using_descriptor", T3."related_id", T3."normal_field",
    T3."related_self_id"
FROM
    "tests_inheritancemanagertestchild4"
INNER JOIN
    "tests_inheritancemanagertestparent" ON
    ("tests_inheritancemanagertestchild4"."parent_ptr_id" = "tests_inheritancemanagertestparent"."id")
INNER JOIN
    "tests_inheritancemanagertestparent" T3 ON
    ("tests_inheritancemanagertestchild4"."other_onetoone_id" = T3."id")
WHERE
    "tests_inheritancemanagertestchild4"."parent_ptr_id" = 191
```

  * with either the fix, or by adding `.select_related(None)` after `.select_subclasses()`
```sql
SELECT
    "tests_inheritancemanagertestparent"."id",
    "tests_inheritancemanagertestparent"."non_related_field_using_descriptor",
    "tests_inheritancemanagertestparent"."related_id",
    "tests_inheritancemanagertestparent"."normal_field",
    "tests_inheritancemanagertestparent"."related_self_id",
    "tests_inheritancemanagertestchild4"."other_onetoone_id",
    "tests_inheritancemanagertestchild4"."parent_ptr_id"
FROM
    "tests_inheritancemanagertestchild4"
INNER JOIN
    "tests_inheritancemanagertestparent" ON
    ("tests_inheritancemanagertestchild4"."parent_ptr_id" = "tests_inheritancemanagertestparent"."id")
WHERE
    "tests_inheritancemanagertestchild4"."parent_ptr_id" = 191

```
2020-07-08 16:59:05 +06:00
Trevor Watson
b7d0abccf4 Document current supported versions 2020-06-11 21:24:11 +06:00
skazancev
bf4b65a437 removed model from DeferredAttributeTracker 2020-05-28 22:40:13 +06:00
Brian Rutledge
71c57e0ebd Fix tox django factors
I noticed this discrepancy while attempting to determine compatibility of versions of django-model-utils and Django. I haven't tested it locally, because I'm getting `psycopg2.OperationalError: could not connect to server`.
2020-04-28 21:36:51 +06:00
Adam Johnson
d7e235603e Document Django 3.0 enumeration types
Could also consider deprecating, at least when minimum supported Django is 3.0.
2020-03-18 09:41:43 +06:00
H. Buğra Aydın
b0a6b78c80 added explanation for the new feature
i forgot to change changes file to explain the feature below, updating accordingly:

3e32ae257b
2020-03-02 16:46:09 +06:00
Martín Raúl Villalba
6fba04ec4f Satisfy deprecation warning under Django 3.0.3 2020-03-01 08:55:31 +06:00
H. Buğra Aydın
3e32ae257b Overriding TimeStampedModel's save() method (#412)
* Overriding TimeStampedModel's save() method

to update modified field automatically when update_fields argument is used but modified was not given as a parameter.

* fixed a small error in logic

* added tests for new functionality
2020-01-23 13:19:06 +06:00