2020-09-29 09:54:31 +02:00
|
|
|
from django.db import models
|
2020-10-01 10:51:19 +02:00
|
|
|
from django.forms import ModelForm, DateField, ChoiceField, RadioSelect
|
2020-09-29 12:16:10 +02:00
|
|
|
from django.contrib.admin.widgets import AdminDateWidget
|
|
|
|
|
2020-10-01 10:51:19 +02:00
|
|
|
from .models import Project, Volunteer, IFG, Library
|
2020-09-29 09:54:31 +02:00
|
|
|
|
|
|
|
class ProjectForm(ModelForm):
|
2020-09-29 12:16:10 +02:00
|
|
|
|
|
|
|
start = DateField(widget=AdminDateWidget)
|
|
|
|
|
2020-09-29 09:54:31 +02:00
|
|
|
class Meta:
|
|
|
|
model = Project
|
2020-10-07 09:45:36 +02:00
|
|
|
# fields = '__all__'
|
|
|
|
exclude = ('pid',)
|
2020-10-01 10:51:19 +02:00
|
|
|
|
|
|
|
class VolunteerForm(ModelForm):
|
|
|
|
|
|
|
|
CHOICES = [('IFG','ifg'),
|
|
|
|
('Lib','library'),]
|
|
|
|
choice = ChoiceField(choices=CHOICES, widget=RadioSelect)
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
model = Volunteer
|
|
|
|
fields = '__all__'
|
|
|
|
|
2020-10-01 12:08:02 +02:00
|
|
|
class LibraryForm(ModelForm):
|
2020-10-01 10:51:19 +02:00
|
|
|
class Meta:
|
|
|
|
model = Library
|
2020-10-01 14:45:04 +02:00
|
|
|
exclude = ('realname', 'email', 'username')
|
2020-10-01 10:51:19 +02:00
|
|
|
|
2020-10-01 12:08:02 +02:00
|
|
|
class IFGForm(ModelForm):
|
2020-10-01 10:51:19 +02:00
|
|
|
class Meta:
|
2020-10-01 12:08:02 +02:00
|
|
|
model = IFG
|
2020-10-05 15:10:23 +02:00
|
|
|
exclude = ('realname', 'email', 'username')
|