December 2018
Beginner to intermediate
404 pages
10h 14m
English
We will revisit the book model to present the several field types available. We should edit the library_app/models/library_book.py file and edit the Book class to look like this:
# class Book(models.Model): # ... # String fields: name = fields.Char('Title') isbn = fields.Char('ISBN') book_type = fields.Selection( [('paper','Paperback'), ('hard','Hardcover'), ('electronic','Electronic'), ('other', 'Other')], 'Type') notes = fields.Text('Internal Notes') descr = fields.Html('Description') # Numeric fields: copies = fields.Integer(default=1) avg_rating = fields.Float('Average Rating', (3, 2)) price = fields.Monetary('Price', 'currency_id') currency_id = fields.Many2one('res.currency') # price helper # Date and time fields: ...Read now
Unlock full access