Skip to content

Instantly share code, notes, and snippets.

@xitij2000
Created October 21, 2011 12:41
Show Gist options
  • Select an option

  • Save xitij2000/1303736 to your computer and use it in GitHub Desktop.

Select an option

Save xitij2000/1303736 to your computer and use it in GitHub Desktop.
models.py
class Person(models.Model):
first_name = models.CharField(max_length=50)
last_name = models.CharField(max_length=50, blank=True)
phone = models.CharField(max_length=15, blank=True)
email = models.EmailField(blank=True)
def __unicode__(self):
return self.first_name + " " + self.last_name
class Book(models.Model):
name = models.CharField(max_length=255)
borrowed_by = models.ForeignKey(Person, blank=True, null=True)
borrowed_on = models.DateField(blank=True, null=True)
def __unicode__(self):
return self.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment