Skip to content

Instantly share code, notes, and snippets.

@eeriksp
Last active February 18, 2019 15:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eeriksp/6988438c85c489f5fcb4d142f298d719 to your computer and use it in GitHub Desktop.
Save eeriksp/6988438c85c489f5fcb4d142f298d719 to your computer and use it in GitHub Desktop.
class Charity(models.Model):
name = models.CharField(max_length=50, unique=True)
webpage = models.URLField(unique=True)
def __str__(self):
return self.name
class Volunteer(models.Model):
charity = models.ForeignKey(Charity, on_delete=models.PROTECT)
name = models.CharField(max_length=50)
email = models.EmailField(unique=True)
def __str__(self):
return self.name
class Project(models.Model):
director = models.ForeignKey(Volunteer, on_delete=models.PROTECT)
name = models.CharField(max_length=50)
deadline = models.DateField()
def __str__(self):
return self.name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment