| 38 | |
| 39 | |
| 40 | class BookInstance(models.Model): |
| 41 | id = models.UUIDField(primary_key=True, default=uuid.uuid4, help_text='Unique ID for this particular book across whole library') |
| 42 | book = models.ForeignKey('Book', on_delete=models.RESTRICT, null=True) |
| 43 | imprint = models.CharField(max_length=200) |
| 44 | due_back = models.DateField(null=True, blank=True) |
| 45 | |
| 46 | LOAN_STATUS = ( |
| 47 | ('Maintenance', 'Maintenance'), |
| 48 | ('Loan', 'On loan'), |
| 49 | ('Available', 'Available'), |
| 50 | ('Reserved', 'Reserved'), |
| 51 | ) |
| 52 | |
| 53 | status = models.CharField(max_length=20, choices=LOAN_STATUS, blank=True, default='Maintenance', help_text='Book availability',) |
| 54 | |
| 55 | class Meta: |
| 56 | ordering = ['due_back'] |
| 57 | |
| 58 | def __str__(self): |
| 59 | return f'{self.id} ({self.book.title})' |
| 60 | |
| 61 | |
| 62 | class Author(models.Model): |
nothing calls this directly
no outgoing calls
no test coverage detected