Skip to content

4.4 step3 correction

Jean Cavallo edited this page Jan 17, 2019 · 4 revisions

Step 3 - Homework correction

The "name" of a genre

This should be a required Char field named name on the library.genre model. Required because we need it to identify the genre. Ideally we should make it unique, that will come later.

The "name" of an editor

Same as above on the library.editor model

The "title" of a book

A required Char field named title on the library.book model

The date at which an editor started its activity

It will be a Date field on the library.editor model. It should not be required since the librarian may not know the information, and it is not necessary to work. It is just a nice information to have.

A good name would be creation_date, but there is no obvsiously good name here. Ending with _date is probably a good idea because that will convey the fact that the field type is Date. Also, a help parameter may be a good idea, if the field name is not explicit enough.

The number of books an author wrote

This is not useful, because it can be computed from the number of books in the database.

The birth date of an author

This is a Date field named birth_date on the library.author model. It should not be required, for the same reason than the library.editor.creation_date should not.

The death date of an author

This is a Date field named death_date on the library.author model. Obviously, it is not required.

A one-line description of a book

This one should be a Char field on the library.book model, named description (not desc or dscptn)

An identifier on an exemplary

An identifier would be a unique barcode on a physical exemplary of a book. It could be either a Char or Integer field. We will go with a required Char field named identifier on the library.book.exemplary model.

You could have used id as name field, but that would not be possible because id is a technical field name managed by tryton, which uniquely identifies a record in the database.