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

Proxy model needs manager definition #376

Open
DiogoMarques29 opened this issue Feb 12, 2019 · 0 comments · May be fixed by #544
Open

Proxy model needs manager definition #376

DiogoMarques29 opened this issue Feb 12, 2019 · 0 comments · May be fixed by #544

Comments

@DiogoMarques29
Copy link

Hello,
I have a class with a custom manager defined by:
objects = PolymorphicManager.from_queryset(PointOfInterestQuerySet)()

The proxy model:

class PointOfInterestGlobalSummary(PointOfInterest):
    class Meta:
        proxy = True
        verbose_name = _('Dashboard - Global')
        verbose_name_plural = _('Dashboard - Global')

Running some queries:

>>> PointOfInterest.objects.all().count()
139534
>>> PointOfInterestGlobalSummary.objects.all().count()
0

The solution was to define the proxy model with a normal manager:
objects = models.Manager()
The queries:

>>> PointOfInterest.objects.all().count()
139534
>>> PointOfInterestGlobalSummary.objects.all().count()
139534

Is this normal behavior? If so, maybe we should add some documentation?

Cheers

@DiogoMarques29 DiogoMarques29 changed the title Proxy model for base class needs manager definition Proxy model needs manager definition Feb 12, 2019
pgammans added a commit to bva-icx/django-polymorphic that referenced this issue Apr 4, 2024
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 a pull request may close this issue.

1 participant