forked from beba/foerderbarometer
60 lines
1.8 KiB
Python
60 lines
1.8 KiB
Python
from django.db import models
|
|
from django.forms import ModelForm, DateField, ChoiceField, RadioSelect, BooleanField
|
|
from django.contrib.admin.widgets import AdminDateWidget
|
|
from django.utils.html import format_html
|
|
|
|
from .models import Project, Volunteer, IFG, Library, TYPE_CHOICES, HonoraryCertificate
|
|
from .settings import DATAPROTECTION, FOERDERRICHTLINIEN
|
|
|
|
|
|
class ProjectForm(ModelForm):
|
|
|
|
start = DateField(widget=AdminDateWidget)
|
|
|
|
class Meta:
|
|
model = Project
|
|
exclude = ('pid',)
|
|
|
|
class VolunteerForm(ModelForm):
|
|
|
|
choice = ChoiceField(choices=TYPE_CHOICES, widget=RadioSelect,
|
|
label='Was möchtest Du beantragen?')
|
|
|
|
check = BooleanField(required=True,
|
|
label=format_html("Ich stimme den <a href='{}'>Datenschutzbestimmungen</a> und den <a href='{}'>Förderrichtlinen</a> zu",
|
|
DATAPROTECTION, FOERDERRICHTLINIEN))
|
|
|
|
class Meta:
|
|
model = Volunteer
|
|
exclude = ('granted',)
|
|
|
|
INTERN_CHOICES = [('PRO', 'Projektsteckbrief'),
|
|
('HON', 'Eherenamtsbescheinigung'),
|
|
('AKK', 'Akkreditierung oder Redaktionsbestätigung'),
|
|
('TRAV', 'Reisekostenerstattung')]
|
|
|
|
class InternForm(ModelForm):
|
|
choice = ChoiceField(choices = INTERN_CHOICES, widget=RadioSelect,
|
|
label = 'Was möchtest Du eingeben?')
|
|
|
|
class Meta:
|
|
model = Volunteer
|
|
exclude = ('granted',)
|
|
|
|
|
|
class LibraryForm(ModelForm):
|
|
|
|
class Meta:
|
|
model = Library
|
|
exclude = ('realname', 'email', 'username', 'type', 'granted')
|
|
|
|
class IFGForm(ModelForm):
|
|
class Meta:
|
|
model = IFG
|
|
exclude = ('realname', 'email', 'username', 'granted')
|
|
|
|
class HonoraryCertificateForm(ModelForm):
|
|
class Meta:
|
|
model = HonoraryCertificate
|
|
exclude = ('realname', 'email', 'username', 'granted')
|