from django.db import models
from .Author import Author
from .Genre import Genre
from django.db.models.deletion import CASCADE



# Model Representing books
class Book(models.Model):
    title= models.TextField()
    author= models.ForeignKey(Author , related_name='books', on_delete=models.CASCADE)
    publishDate= models.DateField()
    genre = models.ManyToManyField(Genre , related_name='genres', blank=True , null=True)
    onLoan = models.BooleanField(default=False)

    
    #to add later
        #publisher
        #publishCode

    def __str__(self) -> str:
        return self.title

27c700a671146b1ffc28fefe9bfb0cf15f65fd4a
<mask token>


class Book(models.Model):
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>

<mask token>


class Book(models.Model):
    <mask token>
    <mask token>
    <mask token>
    <mask token>
    <mask token>

    def __str__(self) ->str:
        return self.title

<mask token>


class Book(models.Model):
    title = models.TextField()
    author = models.ForeignKey(Author, related_name='books', on_delete=
        models.CASCADE)
    publishDate = models.DateField()
    genre = models.ManyToManyField(Genre, related_name='genres', blank=True,
        null=True)
    onLoan = models.BooleanField(default=False)

    def __str__(self) ->str:
        return self.title

from django.db import models
from .Author import Author
from .Genre import Genre
from django.db.models.deletion import CASCADE


class Book(models.Model):
    title = models.TextField()
    author = models.ForeignKey(Author, related_name='books', on_delete=
        models.CASCADE)
    publishDate = models.DateField()
    genre = models.ManyToManyField(Genre, related_name='genres', blank=True,
        null=True)
    onLoan = models.BooleanField(default=False)

    def __str__(self) ->str:
        return self.title

from django.db import models
from .Author import Author
from .Genre import Genre
from django.db.models.deletion import CASCADE



# Model Representing books
class Book(models.Model):
    title= models.TextField()
    author= models.ForeignKey(Author , related_name='books', on_delete=models.CASCADE)
    publishDate= models.DateField()
    genre = models.ManyToManyField(Genre , related_name='genres', blank=True , null=True)
    onLoan = models.BooleanField(default=False)

    
    #to add later
        #publisher
        #publishCode

    def __str__(self) -> str:
        return self.title
