1
0
Fork 0

Foreignkey(Volonteer) added

This commit is contained in:
Benni Bärmann 2020-09-30 11:52:33 +02:00
parent 5cd2d76d20
commit 45a92dfc9c
1 changed files with 8 additions and 7 deletions

View File

@ -1,13 +1,6 @@
from django.db import models
class Project(models.Model):
name = models.CharField(max_length=200)
start = models.DateTimeField('start date')
def __str__(self):
return self.name
class Volonteer(models.Model):
name = models.CharField(max_length=200)
email = models.CharField(max_length=200)
@ -15,3 +8,11 @@ class Volonteer(models.Model):
def __str__(self):
return self.name
class Project(models.Model):
name = models.CharField(max_length=200)
start = models.DateTimeField('start date')
contact = models.ForeignKey(Volonteer, on_delete = models.CASCADE, null = True)
def __str__(self):
return self.name