Skip to content

Conversation

@bckohan
Copy link
Contributor

@bckohan bckohan commented Dec 4, 2025

Fixes #376 #390

I need to rebase and didn't have permissions to push to the original branch for #544, so this replaces that PR.

@codecov
Copy link

codecov bot commented Dec 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.55%. Comparing base (0d820d0) to head (4e2825d).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #676      +/-   ##
==========================================
+ Coverage   75.40%   75.55%   +0.14%     
==========================================
  Files          21       21              
  Lines        1342     1350       +8     
  Branches      211      214       +3     
==========================================
+ Hits         1012     1020       +8     
  Misses        257      257              
  Partials       73       73              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot finished reviewing on behalf of bckohan December 4, 2025 07:25
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new polymorphic__proxy meta option to control whether proxy models behave as traditional Django proxies (aliases) or as polymorphic proxies (distinct types). This addresses issues #376 and #390 by allowing developers to opt-in to traditional Django proxy behavior when needed.

Key Changes

  • Introduced polymorphic__proxy meta attribute that can be set to True (traditional Django proxy/alias) or False (polymorphic proxy with distinct type)
  • Modified the manager's queryset logic to respect the new attribute when applying instance_of filters
  • Added comprehensive test coverage with multiple proxy model variants to validate the new behavior

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/polymorphic/base.py Added metaclass logic to extract and store polymorphic__proxy from model Meta, with default based on proxy setting
src/polymorphic/managers.py Changed queryset logic from checking _meta.proxy to checking _meta.polymorphic__proxy to control instance filtering
src/polymorphic/tests/models.py Added 6 new test model classes demonstrating different proxy configurations and inheritance hierarchies
src/polymorphic/tests/test_orm.py Added 6 new test cases to validate polymorphic proxy behavior, traditional Django proxy behavior, and type conversion scenarios
src/polymorphic/tests/migrations/0001_initial.py Generated migration file for the new test models

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bckohan bckohan force-pushed the django-proxy-support branch from 8bd4107 to a8276fc Compare December 4, 2025 07:39
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.

Proxy model needs manager definition

2 participants