O'Reilly logo

Python 3 Web Development Beginner's Guide by Michel Anders

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action defining the Books database

The next step is to create a module booksdb.py that uses the entity and relation modules to construct a data model that can be used conveniently by the delivery layer (the parts of the web application that deal with providing content to the client). We therefore have to define Book, Author, and User entities as well as a BookAuthor relation and a UserBook relation.

We will also provide some functions that are bit more high-level, for example, a newbook() function that checks whether a book with a given title already exists and that only creates a new Book instance if the authors are different (presumably because they wrote a book with the same title).

Having a separate layer that models data in terms ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required