Commit Graph

13 Commits (ff57aa57a321b158b564857e36ebce2538deaf5f)

Author SHA1 Message Date
Diederik van der Boor ff57aa57a3 include test for missing Meta.manager_inheritance_from_future 2018-02-05 13:31:00 +01:00
Diederik van der Boor f898f80594 Fixed unwanted manager replacement in Django 1.11 projects.
Django 1.11 uses the old manager inheritance system, unless it's
overwritten with manager_inheritance_from_future. With a class layout
like:

  PolymorphicModel  (abstract)
    PolymorphicMPTTModel  (abstract)
      GenericCustomer  (concrete, has objects = ...)
        CustomerGroupBase (abstract, has objects = ...)
          Partner (concrete, no manager)
            BranchPartner  (concrete, no manager)

The last level gets a normal Django Manager instead of the polymorphic
manager. Because the PolymorphicModel had a base_objects manager, this
was typically used as _default_manager. Now that the default manager is
no longer affected, it's also easier to detect why the "objects" doesn't
get the proper manager type. Using "manager_inheritance_from_future" is
recommended instead to have both the right behavior and forward
Django 2.x compatibility.
2018-02-04 13:22:51 +01:00
Charlie Denton e2bf741d5d
Remove models that are not referenced in tests
This silences one instance of the warning that's being printed in tests
for versions of Django before 2.0:

> RemovedInDjango20Warning: Managers from concrete parents will soon
> qualify as default managers if they appear before any other managers
> in the MRO.
2018-01-16 10:53:35 +00:00
Krzysztof Gromadzki 8dc9bd2543 Review applied 2017-12-31 17:14:23 +01:00
Krzysztof Gromadzki 010a23425f Add support for bulk_create 2017-12-29 19:05:57 +01:00
Diederik van der Boor 2e16112cbe Merge branch 'fix-defer-childs-same-polymorphic-parent' into master 2017-09-30 20:26:37 +02:00
Diederik van der Boor fb80233c5d Fix one Django-master error 2017-09-30 18:57:31 +02:00
Diederik van der Boor a950049356 Improved and added more admin test cases 2017-09-30 18:16:59 +02:00
Diederik van der Boor 8d4cb9b151 Added rudimentary admin test cases 2017-09-30 17:47:02 +02:00
Hugo Osvaldo Barrera e102a0502c Update a bunch of failing tests
Tests were failing because of:

* Models weren't being imported from their new location.
* PolymorphicManager doesn't work with non-polymorphic models, but
  migrations run models' manager, so having MROBase3 with
  PolymorphicManager failed.
* Some tests failed due to have assertions were being done (since they
  hardcoded expected instance ids). Update tests to use comparisons
  similar to #312
2017-09-06 20:06:25 -03:00
Hugo Osvaldo Barrera a507345c6d Move test models into models.py and add migrations
Tests were failing on postgres due to foreign keys pointing to missing
tables.
In order for these tables to be present, we need migrations which
declare depending on `content_type`.
2017-09-06 19:47:18 -03:00
Diederik van der Boor 1f15a72a80 Moved polymorphic models back to tests/__init__.py, for Django 1.6- 2017-01-09 15:12:26 +01:00
Diederik van der Boor 9493bd8bc1 split tests.py into a python package 2017-01-09 14:41:56 +01:00