Coverage for book\models.py: 100%

7 statements  

« prev     ^ index     » next       coverage.py v7.4.4, created at 2024-06-29 10:02 +0100

1from django.db import models 

2from django.contrib.auth.models import User 

3from author.models import Author 

4 

5 

6class Book(models.Model): 

7 """ 

8 Represents a book in the library. 

9 

10 Attributes: 

11 title (str): The title of the book. 

12 author (Author): The author of the book. 

13 reader (User): The user who is currently reading the book. 

14 """ 

15 title = models.CharField(max_length=200) 

16 author = models.ForeignKey(Author, on_delete=models.CASCADE) 

17 reader = models.ForeignKey( 

18 User, on_delete=models.SET_NULL, null=True, blank=True)