Adding a line to dynamic lines in django admin

I have the following defined:

class AnswerChoiceInline(admin.TabularInline): model = AnswerChoice # extra = 0 class QuestionAdmin(admin.ModelAdmin): inlines = [AnswerChoiceInline] admin.site.register(Question, QuestionAdmin) 

Obviously, I am getting the default setting by default (default is 3). Is there a way built into the administrator currently to add a new row to the built-in set of fields? So I can fill in 3 lines, and if I need 4th, can I click a link or button and add it an extra line?

At the moment, my workflow is either set to "extra" on an arbitrarily large number, and then it just has empty lines or allows the user to save the model several times (so that additional lines appear).

+3
source share
1 answer

Why yes, look Add and remove Django Admin Inlines with Javascript from Arne Brodowski.

+3
source

Source: https://habr.com/ru/post/1304180/


All Articles