MCPcopy Create free account
hub / github.com/codemistic/Web-Development / BookInstance

Class BookInstance

locallibrary/catalog/models.py:40–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38
39
40class 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
62class Author(models.Model):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected