I want to add fields dynamically in Django 1.8.
Here's my models.py
class Book(models.Model):
title = models.CharField(max_length=100)
def __str__(self):
return self.title
class Author(models.Model):
name = models.CharField(max_length=100)
books = models.ManyToManyField(Book)
def __str__(self):
return self.name
Here's my admin.py
class AuthorAdmin(admin.ModelAdmin):
admin.site.register(Author, AuthorAdmin)
class BookAdmin(admin.ModelAdmin):
admin.site.register(Book, BookAdmin)
Here's how it looks now:
I've tried to use Inline, but I can only add a new book also.
I want to be able to add many books to one author dynamically.
Something like this:

How can I do this?
Edit:
I've changed AuthorAdmin to this:
class AuthorAdmin(admin.ModelAdmin):
formfield_overrides = {
models.ManyToManyField: {'widget': CheckboxSelectMultiple},
}
admin.site.register(Author, AuthorAdmin)
But instead of one checkbox with "N" options, I want "N" textboxes to choose the books.

