Skip to content

Proxy model needs manager definition #376

Open
@DiogoMarques29

Description

@DiogoMarques29

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions