QuerySet class does not inherit from TranslatableQuerySet

  Kiến thức lập trình

I’m working on my Django project, and currently I’m working on localization and translating a website. I have a problem with translating my post for blog part. I already have integrated models and everything and I used PublishedManager in order to filter.

But now since I used django-parler (from parler.models import TranslatableModel, TranslatedFields), now I got this error which is probably because of TranslatableModel.

I have this error:

ImproperlyConfigured at /en/admin/main_app/post/

QuerySet class does not inherit from TranslatableQuerySet

models.py

class Status(models.TextChoices):
    DRAFT = 'DF', 'Draft'
    PUBLISHED = 'PB', 'Published'

class PublishedManager(models.Manager):
    def get_queryset(self):
        return super().get_queryset().filter(status=Status.PUBLISHED)

class Post(TranslatableModel):
    # Your existing fields and methods...

    # My custom manager
    published = PublishedManager()

    # Other methods...

How do I solve this? Thanks in advance!

LEAVE A COMMENT