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, TYPE_CHOICES
|
|
|
|
class ProjectForm(ModelForm):
|
|
|
|
start = DateField(widget=AdminDateWidget)
|
|
|
|
class Meta:
|
|
model = Project
|
|
# fields = '__all__'
|
|
exclude = ('pid',)
|
|
|
|
class VolunteerForm(ModelForm):
|
|
|
|
choice = ChoiceField(choices=TYPE_CHOICES, widget=RadioSelect,
|
|
label='Was möchtest Du beantragen?')
|
|
|
|
class Meta:
|
|
model = Volunteer
|
|
fields = '__all__'
|
|
# labels = {'choice': 'Was möchtest Du beantragen?'}
|
|
|
|
class LibraryForm(ModelForm):
|
|
|
|
class Meta:
|
|
model = Library
|
|
exclude = ('realname', 'email', 'username', 'type')
|
|
|
|
class IFGForm(ModelForm):
|
|
class Meta:
|
|
model = IFG
|
|
exclude = ('realname', 'email', 'username')
|