Created
October 29, 2022 18:04
-
-
Save KabakiAntony/08fb0fdd632f69eb319beef0d35e5c7c to your computer and use it in GitHub Desktop.
updated admin file with filters now
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib import admin | |
from tonyonline.admin import tonyonline_admin_site | |
from .models import Product, ProductImage, Category | |
class ProductAdmin(admin.ModelAdmin): | |
# define how the custom form is going to be rendered | |
list_display = ['name','description','category','price', 'stock', 'available', 'date'] | |
list_filter = ['category'] # add this line | |
tonyonline_admin_site.register(Product, ProductAdmin) | |
tonyonline_admin_site.register(ProductImage) | |
tonyonline_admin_site.register(Category) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment