1
0
Fork 0

more modell stuff

This commit is contained in:
Benni Bärmann 2020-09-30 14:17:38 +02:00
parent 483e0ae90c
commit 866bd95828
2 changed files with 25 additions and 10 deletions

View File

@ -1,8 +1,10 @@
from django.contrib import admin from django.contrib import admin
# Register your models here. # Register your models here.
from .models import Project, HonoraryCertificate, Library from .models import Project, HonoraryCertificate, Library, IFG #, ELitStip
admin.site.register(Project) admin.site.register([Project,
admin.site.register(HonoraryCertificate) HonoraryCertificate,
admin.site.register(Library) Library,
IFG,
])

View File

@ -1,7 +1,7 @@
from django.db import models from django.db import models
class Volonteer(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)
username = models.CharField(max_length=200, null=True) username = models.CharField(max_length=200, null=True)
@ -9,7 +9,7 @@ class Volonteer(models.Model):
class Meta: class Meta:
abstract = True abstract = True
class Project(Volonteer): class Project(Volunteer):
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)
@ -17,18 +17,31 @@ class Project(Volonteer):
def __str__(self): def __str__(self):
return self.name return self.name
class HonoraryCertificate(Volonteer): class HonoraryCertificate(Volunteer):
request_url = models.CharField(max_length=400) #can urls be longer in theory? request_url = models.CharField(max_length=400) #can urls be longer in theory?
number = models.IntegerField(null = True) number = models.IntegerField(null = True)
def __str__(self): def __str__(self):
return "Certificate for " + self.realname return "Certificate for " + self.realname
class Library(Volonteer): #abstract class for Library, IFG, ...
library = models.CharField(max_length=200) class Grant(Volunteer):
cost = models.CharField(max_length=10) cost = models.CharField(max_length=10)
duration = models.CharField(max_length=100)
notes = models.CharField(max_length=500) 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): def __str__(self):
return self.library 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