django multiple select in admin change-list
Our product model can have multiple campaigns. Our customers change these campaigns frequently and generally on multiple products. So what we need right now seems that we need to show a multiple select widget on a change-list of Product model where our customers can easily change the campaigns.
Any idea on this? Maybe another way to achieve this kind of UI interaction?
T开发者_运维百科hanks,
say you have a product model
class Product(models.Model):
name=models.CharField(max_length=20)
cost=models.DecimalField(max_length=10)
you can subclass the admin's Modeladmin to show a list display for the products or you can do a custom modelform for the product which you can call in the product's admin
from django.contrib import admin
from django import forms
class PropertyInline(admin.TabularInine):
model=Property
extra=1
class PropertyForm(admin.ModelAdmin):
inlines=(PropertyInline,)
精彩评论