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
Django Parler shows translated object one time per translation on the admin list #330
Comments
no one? |
Is this project abandoned? |
Hi @temperatio, As a workaround, despite it does not solve the problem but mitigates it a bit, I've added a list filter to show the records translated to the selected language (and they appear only once). This is the code of the language filter: from django.conf import settings
from django.contrib import admin
from parler.admin import TranslatableAdmin
from parler.managers import TranslatableQuerySet
class LanguageListFilter(admin.SimpleListFilter):
title = _("language")
parameter_name = "language"
def lookups(self, request, model_admin):
return settings.LANGUAGES
def queryset(self, request, queryset):
if not self.value():
return queryset
if not isinstance(queryset, TranslatableQuerySet):
return queryset
return queryset.translated(self.value())
class MyModelAdmin(TranslatableAdmin):
model = MyModel
list_filter = (LanguageListFilter, ) |
@temperatio: are you ordering by a translated field? I've been digging more about this problem, and I've found that I had duplicates if I add |
@bielfrontera I have |
I'm using Django 4.1 and django-parler 2.3
Parler related config in settings.py
I created a model using TranslatableModel and TranslatableAdmin. Then I created an object and filled the translatable fields of the same object for every language. When I get to the model list page, I see oneobjects in the list for every translated lenguage. (As you can see on the screenshot below)
It's a bug or I'm doing something wrong.
Regards,
César.
The text was updated successfully, but these errors were encountered: