from django.db import models
from .query import BookQuerySet


class Book(models.Model):

    objects = BookQuerySet.as_manager()

    title = models.CharField(max_length=50)
    publication_date = models.DateTimeField()
    author = models.ForeignKey('Author')
    genres = models.ManyToManyField('Genre')


class Author(models.Model):
    name = models.CharField(max_length=50)
    nationality = models.ForeignKey('Nation', null=True)


class Genre(models.Model):
    name = models.CharField(max_length=50)


class Nation(models.Model):
    name = models.CharField(max_length=50)
    demonym = models.CharField(max_length=50)

[((143, 174), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (159, 174), False, 'from django.db import models\n'), ((198, 220), 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {}), '()\n', (218, 220), False, 'from django.db import models\n'), ((234, 261), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""Author"""'], {}), "('Author')\n", (251, 261), False, 'from django.db import models\n'), ((275, 306), 'django.db.models.ManyToManyField', 'models.ManyToManyField', (['"""Genre"""'], {}), "('Genre')\n", (297, 306), False, 'from django.db import models\n'), ((348, 379), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (364, 379), False, 'from django.db import models\n'), ((398, 436), 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""Nation"""'], {'null': '(True)'}), "('Nation', null=True)\n", (415, 436), False, 'from django.db import models\n'), ((477, 508), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (493, 508), False, 'from django.db import models\n'), ((550, 581), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (566, 581), False, 'from django.db import models\n'), ((596, 627), 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), '(max_length=50)\n', (612, 627), False, 'from django.db import models\n')]