Welcome to JiKe DevOps Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
410 views
in Technique[技术] by (71.8m points)

How to show suggestions of existing child record in TabularInline in django admin?

I want to show suggestion of existing child record while adding child record to parent.

class IndustryInline(admin.TabularInline):
    model = Industry



class ParentIndustriesAdmin(admin.ModelAdmin):
    list_display = ('id', 'name')
    search_fields = ['id', 'name', ]
    ordering = ['-date_modified']
    inlines = [
        IndustryInline,
    ]

    def save_model(self, request, obj, form, change):
        obj.modified_by = request.user
        obj.save()


admin.site.register(ParentIndustry, ParentIndustriesAdmin)

How to get suggestion for existing records like we get in case of ManytoMany relationship.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to JiKe DevOps Community for programmer and developer-Open, Learning and Share
...