[Answered ]-How to display/use a dropdown in the django admin

2👍

✅

The category field is missing because you have defined fieldsets for your model admin, but missing the category` field out. Change it to something like the following.

class ProductAdmin(admin.ModelAdmin):
     fieldsets = [
        (None,          {'fields': ['name']}),
        (None,          {'fields': ['description']}),
        (None,          {'fields': ['category']}),
    ]

As it’s a foreign key, if should be a drop down select box by default.

Leave a comment