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