# Path: modeltrans/admin.py
# class ActiveLanguageMixin:
#     """
#     ModelAdmin mixin to only show fields for the fallback and current language in the change view.
#     """
# 
#     form_class = TranslationModelForm
# 
# Path: tests/app/models.py
# class Blog(models.Model):
#     title = models.CharField(max_length=255)
#     body = models.TextField(null=True)
# 
#     category = models.ForeignKey(Category, null=True, blank=True, on_delete=models.CASCADE)
#     site = models.ForeignKey(Site, null=True, blank=True, on_delete=models.CASCADE)
# 
#     i18n = TranslationField(fields=("title", "body"), required_languages=("nl",))
# 
#     def __str__(self):
#         return self.title
# 
# class Category(models.Model):
# 
#     name = models.CharField(max_length=255)
#     title = models.CharField(max_length=255)
# 
#     i18n = TranslationField(fields=("name", "title"))
# 
#     objects = CategoryQueryset.as_manager()
# 
#     def __str__(self):
#         return self.name
# 
# class Site(models.Model):
#     name = models.CharField(max_length=255)
# 
#     objects = MultilingualManager()
# 
#     def __str__(self):
#         return self.name


from django.contrib import admin
from modeltrans.admin import ActiveLanguageMixin
from .models import Blog, Category, Site




@admin.register(Blog)
class BlogAdmin(admin.ModelAdmin):
    list_display = ("title_i18n", "category")
    search_fields = ("title_i18n", "category__name_i18n", "site__name")


@admin.register(Category)

# Path: modeltrans/admin.py
# class ActiveLanguageMixin:
#     """
#     ModelAdmin mixin to only show fields for the fallback and current language in the change view.
#     """
# 
#     form_class = TranslationModelForm
# 
# Path: tests/app/models.py
# class Blog(models.Model):
#     title = models.CharField(max_length=255)
#     body = models.TextField(null=True)
# 
#     category = models.ForeignKey(Category, null=True, blank=True, on_delete=models.CASCADE)
#     site = models.ForeignKey(Site, null=True, blank=True, on_delete=models.CASCADE)
# 
#     i18n = TranslationField(fields=("title", "body"), required_languages=("nl",))
# 
#     def __str__(self):
#         return self.title
# 
# class Category(models.Model):
# 
#     name = models.CharField(max_length=255)
#     title = models.CharField(max_length=255)
# 
#     i18n = TranslationField(fields=("name", "title"))
# 
#     objects = CategoryQueryset.as_manager()
# 
#     def __str__(self):
#         return self.name
# 
# class Site(models.Model):
#     name = models.CharField(max_length=255)
# 
#     objects = MultilingualManager()
# 
#     def __str__(self):
#         return self.name


# Path: tests/app/admin.py
from django.contrib import admin
from modeltrans.admin import ActiveLanguageMixin
from .models import Blog, Category, Site





@admin.register(Blog)
class BlogAdmin(admin.ModelAdmin):
    list_display = ("title_i18n", "category")
    search_fields = ("title_i18n", "category__name_i18n", "site__name")


@admin.register(Category)

class CategoryAdmin(ActiveLanguageMixin, admin.ModelAdmin):