from django.db import models
|
|
|
|
|
|
class Volunteer(models.Model):
|
|
realname = models.CharField(max_length=200, null=True)
|
|
email = models.CharField(max_length=200, null=True)
|
|
username = models.CharField(max_length=200, null=True)
|
|
|
|
class Meta:
|
|
abstract = True
|
|
|
|
class Project(Volunteer):
|
|
name = models.CharField(max_length=200)
|
|
start = models.DateTimeField('start date')
|
|
# contact = models.ForeignKey(Volonteer, on_delete = models.CASCADE, null = True)
|
|
|
|
# pid = models.IntegerField(null=True) # automaticly generated
|
|
@property
|
|
def pid(self):
|
|
return "hurzel " + str(id)
|
|
|
|
|
|
def __str__(self):
|
|
return self.name
|
|
|
|
class HonoraryCertificate(Volunteer):
|
|
request_url = models.CharField(max_length=400) #can urls be longer in theory?
|
|
number = models.IntegerField(null = True)
|
|
|
|
def __str__(self):
|
|
return "Certificate for " + self.realname
|
|
|
|
#abstract class for Library, IFG, ...
|
|
class Grant(Volunteer):
|
|
cost = models.CharField(max_length=10)
|
|
notes = models.CharField(max_length=500)
|
|
|
|
class Meta:
|
|
abstract = True
|
|
|
|
# should be identical for ELitStip and Software?
|
|
class Library(Grant):
|
|
library = models.CharField(max_length=200)
|
|
duration = models.CharField(max_length=100)
|
|
|
|
def __str__(self):
|
|
return self.library
|
|
|
|
class IFG(Grant):
|
|
url = models.CharField(max_length=400) #can urls be longer in theory?
|
|
|
|
def __str__(self):
|
|
return "IFG-Anfrage von " + self.realname
|