2020-09-29 07:54:31 +00:00
|
|
|
from django.db import models
|
2020-10-20 11:16:03 +00:00
|
|
|
from django.forms import ModelForm, DateField, ChoiceField, RadioSelect, BooleanField
|
2020-09-29 10:16:10 +00:00
|
|
|
from django.contrib.admin.widgets import AdminDateWidget
|
2020-10-20 12:12:12 +00:00
|
|
|
from django.utils.html import format_html
|
2020-09-29 10:16:10 +00:00
|
|
|
|
2020-10-19 12:04:34 +00:00
|
|
|
from .models import Project, Volunteer, IFG, Library, TYPE_CHOICES
|
2020-10-20 12:12:12 +00:00
|
|
|
from .settings import DATAPROTECTION, FOERDERRICHTLINIEN
|
|
|
|
|
2020-09-29 07:54:31 +00:00
|
|
|
|
|
|
|
class ProjectForm(ModelForm):
|
2020-09-29 10:16:10 +00:00
|
|
|
|
|
|
|
start = DateField(widget=AdminDateWidget)
|
|
|
|
|
2020-09-29 07:54:31 +00:00
|
|
|
class Meta:
|
|
|
|
model = Project
|
2020-10-07 07:45:36 +00:00
|
|
|
# fields = '__all__'
|
|
|
|
exclude = ('pid',)
|
2020-10-01 08:51:19 +00:00
|
|
|
|
|
|
|
class VolunteerForm(ModelForm):
|
|
|
|
|
2020-10-19 12:46:58 +00:00
|
|
|
choice = ChoiceField(choices=TYPE_CHOICES, widget=RadioSelect,
|
|
|
|
label='Was möchtest Du beantragen?')
|
2020-10-01 08:51:19 +00:00
|
|
|
|
2020-10-20 12:12:12 +00:00
|
|
|
check = BooleanField(required=True,
|
|
|
|
label=format_html("Ich stimme den <a href='{}'>Datenschutzbestimmungen</a> und den <a href='{}'>Förderrichtlinen</a> zu",
|
|
|
|
DATAPROTECTION, FOERDERRICHTLINIEN))
|
2020-10-20 11:16:03 +00:00
|
|
|
|
2020-10-01 08:51:19 +00:00
|
|
|
class Meta:
|
|
|
|
model = Volunteer
|
2020-10-20 07:35:04 +00:00
|
|
|
exclude = ('granted',)
|
2020-10-01 08:51:19 +00:00
|
|
|
|
2020-10-01 10:08:02 +00:00
|
|
|
class LibraryForm(ModelForm):
|
2020-10-19 11:29:36 +00:00
|
|
|
|
2020-10-01 08:51:19 +00:00
|
|
|
class Meta:
|
|
|
|
model = Library
|
2020-10-20 07:35:04 +00:00
|
|
|
exclude = ('realname', 'email', 'username', 'type', 'granted')
|
2020-10-01 08:51:19 +00:00
|
|
|
|
2020-10-01 10:08:02 +00:00
|
|
|
class IFGForm(ModelForm):
|
2020-10-01 08:51:19 +00:00
|
|
|
class Meta:
|
2020-10-01 10:08:02 +00:00
|
|
|
model = IFG
|
2020-10-05 13:10:23 +00:00
|
|
|
exclude = ('realname', 'email', 'username')
|