Sean Brant
unread,Jul 3, 2010, 1:46:03 PM7/3/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
I have these models and model admins and I was hoping inlines = []
inside a admin.TabularInline would work, but it doesn't seem to.
################################################
class Size(models.Model):
pass
class Product(models.Model):
pass
class ProductType(models.Model):
title = models.CharField(_('title'), max_length=200)
product = models.ForeignKey(Product, verbose_name=_('product'))
sizes = models.ManyToManyField(Size, through='ProductSize')
class ProductSize(models.Model):
product_type = models.ForeignKey(ProductType,
verbose_name=_('product type'))
size = models.ForeignKey(Size, verbose_name=_('size'))
quantity = models.IntegerField()
class ProductSizeInline(admin.TabularInline):
model = Product Size
class ProductTypeInline(admin.TabularInline):
model = ProductType
inlines = (ProductSizeInline,)
class ProductAdmin(admin.ModelAdmin):
inlines = (ProductTypeInline,)
admin.site.register(Product, ProductAdmin)
################################################
Im not even sure if this is best way to display things, I would like
one main product edit screen that lets you attach "product types"
which have "sizes" to a "product", it seems jumping between a bunch of
screens is not good ux. Wondering if I need to create a custom view
for this? Thanks for any help.