<reponame>FreeN1ckname/web_api<filename>webApi/books_api/book/models.py
from django.db import models


class Author(models.Model):
    name = models.CharField(max_length=255)

    def __str__(self):
        return self.name


class Book(models.Model):
    image_path = models.TextField()
    title = models.CharField(max_length=120)
    description = models.TextField()
    full_description = models.TextField()
    author = models.ForeignKey('Author', related_name='books', on_delete=models.CASCADE)
    pages = models.IntegerField()
    genre = models.CharField(max_length=255)
    date = models.DateField()
    price = models.IntegerField()

    def __str__(self):
        return self.title

from django.db import models


class Author(models.Model):
    name = models.CharField(max_length=255)

    def __str__(self):
        return self.name


class Book(models.Model):
    image_path = models.TextField()
    title = models.CharField(max_length=120)
    description = models.TextField()
    full_description = models.TextField()
    author = models.ForeignKey('Author', related_name='books', on_delete=models.CASCADE)
    pages = models.IntegerField()
    genre = models.CharField(max_length=255)
    date = models.DateField()
    price = models.IntegerField()

    def __str__(self):
        return self.title