On one we built four tables person_publisher, person_author, person_book, person_author_book:
Finally, a table is many-created automatically by the system.
The default primary key in the Book publisher associated Publisher, generates a publisher_id field.
(1) to obtain the object named gong (note that we get is an object)
author_obj = models.Author.objects.get(name="gong") print(author_obj) 输出:author_name:gong
(2) create- named as the author of a new book gong
author_obj.book.create (title = " ZABBIX Mastering " , publisher_id =. 3)
(3) add- author is gong to add a book (java)
book_obj = models.Book.objects.get(title="java") author_obj.book.add(book_obj)
(4) remove- is gong to delete a book author (python)
book_obj = models.Book.objects.get(title="java") author_obj.book.remove(book_obj)
(5) as a white author, delete a book, id book is 4
author_obj.book.remove(4)
(6) clear- the author of the book associated gong, delete all empty
author_obj.book.clear()