Skip to content

Instantly share code, notes, and snippets.

@JeffersonCarvalh0
Last active October 5, 2017 20:16
Show Gist options
  • Save JeffersonCarvalh0/8ed4ccb7af278a32e66a81f5ac6a20c9 to your computer and use it in GitHub Desktop.
Save JeffersonCarvalh0/8ed4ccb7af278a32e66a81f5ac6a20c9 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Publisher(models.Model):
'''
Publisher (Editora)
'''
name = models.CharField(max_length=30)
address = models.CharField(max_length = 50)
city = models.CharField(max_length = 60)
state_province = models.CharField(max_length = 30)
country = models.CharField(max_length = 50)
website = models.URLField()
class Author(models.Model):
'''
Author (Autor)
'''
first_name = models.CharField(max_length = 30)
last_name = models.CharField(max_length = 40)
email = models.EmailField()
class Book(models.Model):
'''
Book (Livro)
'''
title = models.CharField(max_length = 100)
authors = models.ManyToManyField(Author)
publisher = models.ForeignKey(Publisher)
publication_date = models.DateField()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment