Skip to content

Instantly share code, notes, and snippets.

@ricardosiri68
Last active December 27, 2015 12:48
Show Gist options
  • Save ricardosiri68/7328063 to your computer and use it in GitHub Desktop.
Save ricardosiri68/7328063 to your computer and use it in GitHub Desktop.
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