Skip to content

Instantly share code, notes, and snippets.

@KabakiAntony
Created October 29, 2022 18:04
Show Gist options
  • Save KabakiAntony/08fb0fdd632f69eb319beef0d35e5c7c to your computer and use it in GitHub Desktop.
Save KabakiAntony/08fb0fdd632f69eb319beef0d35e5c7c to your computer and use it in GitHub Desktop.
updated admin file with filters now
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