Created
March 14, 2017 15:27
-
-
Save leonardocintra/93b57d03cfb21dacea127367cab0951e to your computer and use it in GitHub Desktop.
Cadastro da Imagem do Produto junto com o cadastro do Produto
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 .models import Product, ProductImage | |
class ProductImageInline(admin.TabularInline): | |
model = ProductImage | |
extra = 5 | |
class ProductAdmin(admin.ModelAdmin): | |
list_display = ['name', 'slug', 'category', 'created', 'modified'] | |
search_fields = ['name', 'slug', 'category__name'] | |
list_filter = ['created', 'modified'] | |
prepopulated_fields = {'slug': ('name', )} | |
inlines = [ProductImageInline] | |
admin.site.register(Product, ProductAdmin) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment