3

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 get the default extras setting (default is 3). Is there a way built into the admin currently to 'Add another row' to the inline fieldset? So I can fill in say 3 rows, and if I need a 4th I can click a link or button, and have it add an additional row?

Right now my work flow is either set 'extra' to an arbitrarily large number and then just have blank rows or make the user save the model multiple times (so that the extra rows show up).

1
  • I also understand that the 'Save and Continue' sorta does what I want... but seeing if there were any other mechanisms. Commented Feb 6, 2009 at 14:25

1 Answer 1

3

Why yes, check out Add and remove Django Admin Inlines with Javascript by Arne Brodowski.

Sign up to request clarification or add additional context in comments.

1 Comment

In my experience that code required some tweaking to get it working with more complex cases, but it's a very helpful start.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.