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)

[((9, 12, 9, 43), 'django.db.models.CharField', 'models.CharField', (), '', False, 'from django.db import models\n'), ((10, 23, 10, 45), 'django.db.models.DateTimeField', 'models.DateTimeField', ({}, {}), '()', False, 'from django.db import models\n'), ((11, 13, 11, 40), 'django.db.models.ForeignKey', 'models.ForeignKey', ({(11, 31, 11, 39): '"""Author"""'}, {}), "('Author')", False, 'from django.db import models\n'), ((12, 13, 12, 44), 'django.db.models.ManyToManyField', 'models.ManyToManyField', ({(12, 36, 12, 43): '"""Genre"""'}, {}), "('Genre')", False, 'from django.db import models\n'), ((16, 11, 16, 42), 'django.db.models.CharField', 'models.CharField', (), '', False, 'from django.db import models\n'), ((17, 18, 17, 56), 'django.db.models.ForeignKey', 'models.ForeignKey', (), '', False, 'from django.db import models\n'), ((21, 11, 21, 42), 'django.db.models.CharField', 'models.CharField', (), '', False, 'from django.db import models\n'), ((25, 11, 25, 42), 'django.db.models.CharField', 'models.CharField', (), '', False, 'from django.db import models\n'), ((26, 14, 26, 45), 'django.db.models.CharField', 'models.CharField', (), '', False, 'from django.db import models\n')]