在django admin中设置admin.TabularInline的数量

时间:2012-03-05 06:58:13

标签: python django django-admin

如何在admin.Tabularline中设置django admin的数量?默认情况下,它显示3个空行,我只想显示1个空行。

class ClientPaymentOptionInline(admin.TabularInline):
    model = ClientPaymentOption
    fields = ('name', 'action','percent', 'fixamount', 'itemcharged', 'client')
class ClientAdmin(admin.ModelAdmin):
    #display list
    list_display = ('name','b_type','banner','logo',
                    'contact','address','account_type',
                    'status','currency','color','user',
                    )
    #display fields
    fields = ('name','b_type','banner','logo','contact',
              'address','account_type','status',
              'currency','color','user',
              )
    inlines = [ClientPaymentOptionInline]

admin.site.register(Client, ClientAdmin)

1 个答案:

答案 0 :(得分:9)

将内联的extra属性设置为1。