Fixes issue #175 (possible exception with custom managers hiding som…#176
Fixes issue #175 (possible exception with custom managers hiding som…#176JirkaV wants to merge 2 commits intosoynatan:masterfrom
Conversation
| # created or updated? | ||
| if not created: | ||
| old_model = sender.objects.get(pk=instance.pk) | ||
| old_model = sender._default_manager.get(pk=instance.pk) |
There was a problem hiding this comment.
https://docs.djangoproject.com/en/4.0/topics/db/managers/#default-managers-1, https://docs.djangoproject.com/en/4.0/topics/db/managers/#base-managers
can someone verify the most correct solution?
There was a problem hiding this comment.
It should be _base_manager which will always return all records, the _default_manager may be filtering out records and can still raise an DoesNotExist exception.
| # created or updated? | ||
| if not created: | ||
| old_model = sender.objects.get(pk=instance.pk) | ||
| old_model = sender._default_manager.get(pk=instance.pk) |
There was a problem hiding this comment.
https://docs.djangoproject.com/en/4.0/topics/db/managers/#default-managers-1, https://docs.djangoproject.com/en/4.0/topics/db/managers/#base-managers
can someone verify the most correct solution?
|
|
|
Is there a chance that the pull request will be accepted? |
|
Hi I also encountered this - could that be fixed? |
|
Any progress with this? |
As promised - use Django
_default_managerto prevent exceptions when custom manager excludes certain model instances.