granted_date added

This commit is contained in:
Benni Bärmann 2020-10-22 16:02:59 +02:00
parent d3ba817b09
commit bb2b40e50d
3 changed files with 46 additions and 7 deletions

View File

@ -13,7 +13,7 @@ class ProjectForm(ModelForm):
class Meta: class Meta:
model = Project model = Project
exclude = ('pid', 'granted', 'username', 'realname', 'email', 'project_end_mail', 'survey_mail_send') exclude = ('pid', 'granted', 'granted_date', 'username', 'realname', 'email', 'project_end_mail', 'survey_mail_send')
widgets = {'start': AdminDateWidget(), widgets = {'start': AdminDateWidget(),
'end': AdminDateWidget(),} 'end': AdminDateWidget(),}
@ -28,7 +28,7 @@ class VolunteerForm(ModelForm):
class Meta: class Meta:
model = Volunteer model = Volunteer
exclude = ('granted','survey_mail_send') exclude = ('granted', 'granted_date', 'survey_mail_send')
INTERN_CHOICES = [('PRO', 'Projektsteckbrief'), INTERN_CHOICES = [('PRO', 'Projektsteckbrief'),
('HON', 'Ehrenamtsbescheinigung'), ('HON', 'Ehrenamtsbescheinigung'),
@ -41,21 +41,21 @@ class InternForm(ModelForm):
class Meta: class Meta:
model = Volunteer model = Volunteer
exclude = ('granted','survey_mail_send') exclude = ('granted', 'granted_date', 'survey_mail_send')
class LibraryForm(ModelForm): class LibraryForm(ModelForm):
class Meta: class Meta:
model = Library model = Library
exclude = ('realname', 'email', 'username', 'type', 'granted', 'survey_mail_send') exclude = ('realname', 'email', 'username', 'type', 'granted', 'granted_date', 'survey_mail_send')
class IFGForm(ModelForm): class IFGForm(ModelForm):
class Meta: class Meta:
model = IFG model = IFG
exclude = ('realname', 'email', 'username', 'granted', 'survey_mail_send') exclude = ('realname', 'email', 'username', 'granted', 'granted_date', 'survey_mail_send')
class HonoraryCertificateForm(ModelForm): class HonoraryCertificateForm(ModelForm):
class Meta: class Meta:
model = HonoraryCertificate model = HonoraryCertificate
exclude = ('realname', 'email', 'username', 'granted', 'survey_mail_send') exclude = ('realname', 'email', 'username', 'granted', 'granted_date', 'survey_mail_send')

View File

@ -0,0 +1,33 @@
# Generated by Django 3.1.1 on 2020-10-22 14:00
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('input', '0022_auto_20201022_1233'),
]
operations = [
migrations.AddField(
model_name='honorarycertificate',
name='granted_date',
field=models.DateField(null=True),
),
migrations.AddField(
model_name='ifg',
name='granted_date',
field=models.DateField(null=True),
),
migrations.AddField(
model_name='library',
name='granted_date',
field=models.DateField(null=True),
),
migrations.AddField(
model_name='project',
name='granted_date',
field=models.DateField(null=True),
),
]

View File

@ -1,3 +1,5 @@
from datetime import date
from django.db import models from django.db import models
from .settings import ACCOUNTS from .settings import ACCOUNTS
@ -7,13 +9,17 @@ 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)
# the following Fields are not supposed to be edited by users
granted = models.BooleanField(null=True) granted = models.BooleanField(null=True)
granted_date = models.DateField(null=True)
survey_mail_send = models.BooleanField(null=True) survey_mail_send = models.BooleanField(null=True)
@classmethod @classmethod
def set_granted(cl, key, b): def set_granted(cl, key, b):
obj = cl.objects.get(pk=key) obj = cl.objects.get(pk=key)
obj.granted = b obj.granted = b
obj.granted_date = date.today()
obj.save() obj.save()
class Meta: class Meta:
@ -27,7 +33,7 @@ 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,)
# the following Fields are not supposed to be editet by users # the following Fields are not supposed to be edited by users
pid = models.IntegerField(null=True, blank=True) pid = models.IntegerField(null=True, blank=True)
end_mail_send = models.BooleanField(null=True) end_mail_send = models.BooleanField(null=True)