Skip to content
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

Fixes issue #175 (possible exception with custom managers hiding som… #176

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

JirkaV
Copy link

@JirkaV JirkaV commented Feb 6, 2021

As promised - use Django _default_manager to prevent exceptions when custom manager excludes certain model instances.

@JirkaV JirkaV changed the title Fix for Issue 175 (possible exception with custom managers hiding som… Fix for Issue #175 (possible exception with custom managers hiding som… Feb 6, 2021
@JirkaV JirkaV changed the title Fix for Issue #175 (possible exception with custom managers hiding som… Fixes issue #175 (possible exception with custom managers hiding som… Feb 6, 2021
@@ -68,7 +68,7 @@ def pre_save(sender, instance, raw, using, update_fields, **kwargs):

# created or updated?
if not created:
old_model = sender.objects.get(pk=instance.pk)
old_model = sender._default_manager.get(pk=instance.pk)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_base_manager i think

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -68,7 +68,7 @@ def pre_save(sender, instance, raw, using, update_fields, **kwargs):

# created or updated?
if not created:
old_model = sender.objects.get(pk=instance.pk)
old_model = sender._default_manager.get(pk=instance.pk)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants