@ -2,6 +2,7 @@ from django.db import models
from .settings import ACCOUNTS
class Volunteer ( models . Model ) :
realname = models . CharField ( max_length = 200 , null = True )
email = models . CharField ( max_length = 200 , null = True )
@ -17,6 +18,7 @@ class Volunteer(models.Model):
class Meta :
abstract = True
class Project ( Volunteer ) :
name = models . CharField ( max_length = 200 )
start = models . DateField ( ' Startdatum ' , null = True )
@ -24,7 +26,9 @@ class Project(Volunteer):
account = models . CharField ( ' Kostenstelle ' , max_length = 5 ,
choices = ACCOUNTS . items ( ) , null = True , )
pid = models . IntegerField ( null = True , blank = True ) # automaticly generated
# the following Fields are not supposed to be editet by users
pid = models . IntegerField ( null = True , blank = True )
end_mail_send = models . BooleanField ( null = True )
def save ( self , * args , * * kwargs ) :
# is there a way to call super().save() only once?
@ -35,6 +39,7 @@ class Project(Volunteer):
def __str__ ( self ) :
return f " {self.pid} {self.name} "
class HonoraryCertificate ( Volunteer ) :
request_url = models . CharField ( max_length = 2000 )
project = models . ForeignKey ( Project , null = True , on_delete = models . SET_NULL )
@ -42,7 +47,8 @@ class HonoraryCertificate(Volunteer):
def __str__ ( self ) :
return " Certificate for " + self . realname
#abstract class for Library, IFG, ...
#abstract base class for Library, IFG, ...
class Grant ( Volunteer ) :
cost = models . CharField ( max_length = 10 )
notes = models . CharField ( max_length = 500 )
@ -60,6 +66,7 @@ TYPE_CHOICES = {'BIB': 'Bibliotheksstipendium',
' IFG ' : ' Kostenübernahme IFG-Anfrage ' ,
' LIT ' : ' Literaturstipendium ' , }
# same model is used for Library, ELitStip and Software!
class Library ( Grant ) :
@ -74,6 +81,7 @@ class Library(Grant):
def __str__ ( self ) :
return self . library
class IFG ( Grant ) :
url = models . CharField ( max_length = 2000 )