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, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), False, 'from django.db import models\n'), (10, 'django.db.models.DateTimeField', 'models.DateTimeField', ([], {}), False, 'from django.db import models\n'), (11, 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""Author"""'], {}), False, 'from django.db import models\n'), (12, 'django.db.models.ManyToManyField', 'models.ManyToManyField', (['"""Genre"""'], {}), False, 'from django.db import models\n'), (16, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), False, 'from django.db import models\n'), (17, 'django.db.models.ForeignKey', 'models.ForeignKey', (['"""Nation"""'], {'null': '(True)'}), False, 'from django.db import models\n'), (21, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), False, 'from django.db import models\n'), (25, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), False, 'from django.db import models\n'), (26, 'django.db.models.CharField', 'models.CharField', ([], {'max_length': '(50)'}), False, 'from django.db import models\n')]