New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using cls.__dict__ sometimes returns <class 'django.db.models.manager.ManagerDescriptor'> #369
Comments
Here's the exact cause: a01b157 But I realize it fixes another important issue. |
Hi Ben The last comment on the django-wiki ticket implies this is something to do with Perhaps you could you clarify a bit? |
@craigds thanks for getting back I had to halt the investigation, but I'm trying to figure it out. I was building a test case for django-mptt but it somehow succeeds (oh no!!! Human rant: So the problem is caused by django-wiki's custom manager... it something isn't playing the right way, since |
Btw thanks for a great project again!!! |
Okay I've found the problem, it's essentially this: class MyModel(MPTTModel):
objects = MyCustomManager()
_default_manager = objects # <- THAT IS THE PROBLEM |
...now I just need to figure out why that line was introduced |
Confirming that django-wiki is working after commenting out the |
Also confirming that I can make the django-mptt tests break by introducing this line... wondering if it's relevant since googling stuff about this issue reveals issues about older django versions. |
Okay, it's all in #370 I would add that it seems removing |
…ts for custom TreeManagers. Squashed commit of the following: commit d55f90c8f0b0b6c90a91ba04b1db1e34af099593 Author: Benjamin Bach <benjaoming@gmail.com> Date: Thu Apr 23 02:32:20 2015 +0200 re-enable _default_manager and remove test that fails for some other reason on django 1.4 django-mptt/django-mptt#371 commit 3939f182564c2d1b32a70efb7a5c910234da3887 Author: Benjamin Bach <benjaoming@gmail.com> Date: Thu Apr 23 02:20:58 2015 +0200 Oh hi Travis, can you check this again to see how Django 1.4 likes _default_manager ? commit 17957e03d2b6f9abbf7db890914194489af2929e Author: Benjamin Bach <benjaoming@gmail.com> Date: Thu Apr 23 02:09:20 2015 +0200 also assert that the classic version of .none() is compatible with the custom manager's queryset commit 1cf707d0dae042387f3fae1e34739860f1dbdf2d Author: Benjamin Bach <benjaoming@gmail.com> Date: Thu Apr 23 01:59:22 2015 +0200 fix for django-mptt/django-mptt#371 by customizing test to behave differently if it's pre django 1.6 commit fcf90deeaf1f4e4d4a3bb9e8be265cd4e475d576 Author: Benjamin Bach <benjaoming@gmail.com> Date: Thu Apr 23 01:47:20 2015 +0200 Re-add _default_manager but uncomment test that's generally failing on django 1.4 commit 073698bf2f13b5ab3b77916ce434a46a183c83f6 Author: Benjamin Bach <benjaoming@gmail.com> Date: Thu Apr 23 01:26:59 2015 +0200 Hi Travis, please test if this works with Django 1.4 because it didnt B4 commit 04308a02f3a0fb2b3e2e9a8a55593de330c3aaaa Author: Benjamin Bach <benjaoming@gmail.com> Date: Thu Apr 23 01:13:41 2015 +0200 Renaming custom manager in doctests commit 92737e9890babe7f310ad0bd4b0594d49c000eb8 Author: Benjamin Bach <benjaoming@gmail.com> Date: Thu Apr 23 01:04:19 2015 +0200 Add optimization: If conventional "objects" attr exists, just use that and don't iterate everything else, also fixes django-mptt/django-mptt#369 commit 2b47ffd611158fa91c44398e584b2c5f1f1e96bf Author: Benjamin Bach <benjaoming@gmail.com> Date: Thu Apr 23 01:03:42 2015 +0200 Add test cases that fail when using _default_manager and objects django-mptt/django-mptt#369 commit 1ba49283070e2fda7d00bdd2680a0f9a039c890f Author: Benjamin Bach <benjaoming@gmail.com> Date: Thu Apr 23 01:02:25 2015 +0200 Add a custom method and a _default_manager that points to "objects" to reflect a practice that may or may not exist out there in the wild django-mptt/django-mptt#369 commit 00933d01a3974c088330fb77bfeb7e65dbecf185 Author: Benjamin Bach <benjaoming@gmail.com> Date: Thu Apr 23 01:01:56 2015 +0200 add a single row on the Person test model
I'm having problems that I didn't get to the bottom of, except that reverting back to
getattr
instead of accessing via__dict__
is the remedy.Problem was that a custom manager was not set, and we were defaulting back to TreeManager.
The culprit was this:
It was causing django-wiki/django-wiki#404
PR coming in......
The text was updated successfully, but these errors were encountered: