Skip to content

Fix OrderedModelManager warnings in Sponsorship models (#2743) #2760

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MisbahAN
Copy link

Overview

This PR resolves the warning (ordered_model.W003) for both SponsorshipBenefit and SponsorshipPackage models. These models subclass OrderedModel but were previously using managers that did not inherit from OrderedModelManager.

Changes Made

  • Updated SponsorshipPackage to use OrderedModelManager.from_queryset(SponsorshipPackageQuerySet)()
  • Updated SponsorshipBenefit to use OrderedModelManager.from_queryset(SponsorshipBenefitQuerySet)()
  • Added necessary import for OrderedModelManager

Why This Fixes the Warning

Using .as_manager() does not ensure that the resulting manager inherits from OrderedModelManager, even if the queryset does. Using .from_queryset() ensures the manager inherits from OrderedModelManager while preserving custom queryset functionality.

Fixes #2743

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.

Tests: Investigate OrderedModelManager warning for Sponsor models
1 participant