You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I set category to list filter but it does not load in admin panel as filter.
But when I use django default admin then it works properly.
Please help
The text was updated successfully, but these errors were encountered:
AyanNandaGoswami
changed the title
Foreignkey is not loading in list_filter properly
Foreignkey field does not load in list_filter properly
Jun 25, 2024
class ProductSubcategory(ModelMixin):
category = models.ForeignKey(ProductCategory, on_delete=models.CASCADE, verbose_name=('Category'),
related_name='subcategories')
name = models.CharField(max_length=100, unique=True, primary_key=False, verbose_name=('Subcategory name'))
thumbnail = models.ImageField(upload_to=get_subcategory_thumbnail_upload_path, verbose_name=('Thumbnail'))
cover_image = models.ImageField(upload_to=get_subcategory_coverimage_upload_path, verbose_name=('Cover image'))
sort_order = models.IntegerField(default=0)
@admin.register(ProductSubcategory)
class ProductSubcategoryAdmin(ModelMixinAdmin):
list_display = ('uuid', 'category_name', 'name', 'status', 'sort_order')
list_filter = ModelMixinAdmin.list_filter + ('category', )
raw_id_fields = ModelMixinAdmin.raw_id_fields + ('category', )
I set
category
to list filter but it does not load in admin panel as filter.But when I use django default admin then it works properly.
Please help
The text was updated successfully, but these errors were encountered: