Skip to content
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

Foreignkey field does not load in list_filter properly #582

Open
AyanNandaGoswami opened this issue Jun 25, 2024 · 0 comments
Open

Foreignkey field does not load in list_filter properly #582

AyanNandaGoswami opened this issue Jun 25, 2024 · 0 comments

Comments

@AyanNandaGoswami
Copy link

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

@AyanNandaGoswami AyanNandaGoswami changed the title Foreignkey is not loading in list_filter properly Foreignkey field does not load in list_filter properly Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant