[Answer]-Django modelformset create one object

1👍

Try using max_num and extra fields while creating model formset as

AuthorFormSet = modelformset_factory(Author, max_num=1, extra=1)    

This will try to show at most 1 form, if there isn’t any existing.

However, you may want to think if you really have to use modelformset as @Daniel Roseman suggested.

👤Rohan

Leave a comment