foerderbarometer/input/forms.py

39 lines
1.1 KiB
Python

from django.db import models
from django.forms import ModelForm, DateField, ChoiceField, RadioSelect
from django.contrib.admin.widgets import AdminDateWidget
from .models import Project, Volunteer, IFG, Library
class ProjectForm(ModelForm):
start = DateField(widget=AdminDateWidget)
class Meta:
model = Project
# fields = '__all__'
exclude = ('pid',)
class VolunteerForm(ModelForm):
CHOICES = [('BIB', 'Bibliotheksstipendium'),
('ELIT', 'eLiteraturstipendium'),
('SOFT', 'Softwarestipendium'),
('VIS', 'Visitenkarten, Mailingliste oder E-Mail-Adresse'),
('IFG', 'Kostenübernahme IFG-Anfrage'),
('LIB', 'library'),]
choice = ChoiceField(choices=CHOICES, widget=RadioSelect)
class Meta:
model = Volunteer
fields = '__all__'
class LibraryForm(ModelForm):
class Meta:
model = Library
exclude = ('realname', 'email', 'username')
class IFGForm(ModelForm):
class Meta:
model = IFG
exclude = ('realname', 'email', 'username')