From 866bd958282253ed6d06ca1698dc33fd18d5ea65 Mon Sep 17 00:00:00 2001 From: Benni Baermann Date: Wed, 30 Sep 2020 14:17:38 +0200 Subject: [PATCH] more modell stuff --- input/admin.py | 10 ++++++---- input/models.py | 25 +++++++++++++++++++------ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/input/admin.py b/input/admin.py index a996cbd..f7cfbb6 100644 --- a/input/admin.py +++ b/input/admin.py @@ -1,8 +1,10 @@ from django.contrib import admin # 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(HonoraryCertificate) -admin.site.register(Library) +admin.site.register([Project, + HonoraryCertificate, + Library, + IFG, + ]) diff --git a/input/models.py b/input/models.py index a127fb6..6d3e8d2 100644 --- a/input/models.py +++ b/input/models.py @@ -1,7 +1,7 @@ from django.db import models -class Volonteer(models.Model): +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) @@ -9,7 +9,7 @@ class Volonteer(models.Model): class Meta: abstract = True -class Project(Volonteer): +class Project(Volunteer): name = models.CharField(max_length=200) start = models.DateTimeField('start date') # contact = models.ForeignKey(Volonteer, on_delete = models.CASCADE, null = True) @@ -17,18 +17,31 @@ class Project(Volonteer): def __str__(self): return self.name -class HonoraryCertificate(Volonteer): +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 -class Library(Volonteer): - library = models.CharField(max_length=200) +#abstract class for Library, IFG, ... +class Grant(Volunteer): cost = models.CharField(max_length=10) - duration = models.CharField(max_length=100) 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