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.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to