Last active
December 27, 2015 12:48
-
-
Save ricardosiri68/7328063 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.db import models | |
class Autor(models.Model): | |
id = models.AutoField(primary_key=True) | |
nombre = models.CharFIeld(max_length=100) | |
class Libro(models.Model): | |
id = models.AutoField(primary_key=True) | |
nombre = models.CharField(max_length=100) | |
autor = models.ForeignKey(Autor) | |
class Biblioteca(models.Model): | |
id = models.AutoField(primary_key=True) | |
nombre = models.CharField(max_length=100) | |
direccion = models.CharField(max_length=100) | |
libros = models.ManyToManyField(Libro) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment