moved Volonteer to abstract base class

This commit is contained in:
Benni Bärmann 2020-09-30 12:15:58 +02:00
parent 45a92dfc9c
commit f579521a1a
1 changed files with 7 additions and 7 deletions

View File

@ -2,17 +2,17 @@ from django.db import models
class Volonteer(models.Model): class Volonteer(models.Model):
name = models.CharField(max_length=200) realname = models.CharField(max_length=200, null=True)
email = models.CharField(max_length=200) email = models.CharField(max_length=200, null=True)
username = models.CharField(max_length=200) username = models.CharField(max_length=200, null=True)
def __str__(self): class Meta:
return self.name abstract = True
class Project(models.Model): class Project(Volonteer):
name = models.CharField(max_length=200) name = models.CharField(max_length=200)
start = models.DateTimeField('start date') start = models.DateTimeField('start date')
contact = models.ForeignKey(Volonteer, on_delete = models.CASCADE, null = True) # contact = models.ForeignKey(Volonteer, on_delete = models.CASCADE, null = True)
def __str__(self): def __str__(self):
return self.name return self.name