且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Django Admin:动态添加内联

更新时间:2023-02-08 19:37:14

我尚未对此进行测试,但是从理论上讲,您可以这样做:

I haven't tested this, but in theory you could do:

class MyTemplateAdmin(admin.ModelAdmin):
    def __init__(self, *args, **kwargs):
        super(MyTemplateAdmin, self).__init__(*args, **kwargs)
        #see if there are new templates
        #and set the inlines list property

    list_display = ('name')
    search_fields = ['name']

希望对您有帮助.