You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.2 KiB

4 years ago
  1. from django.db import models
  2. from django.forms import ModelForm, DateField, ChoiceField, RadioSelect, BooleanField
  3. from django.contrib.admin.widgets import AdminDateWidget
  4. from django.utils.html import format_html
  5. from .models import Project, Volunteer, IFG, Library, TYPE_CHOICES
  6. from .settings import DATAPROTECTION, FOERDERRICHTLINIEN
  7. class ProjectForm(ModelForm):
  8. start = DateField(widget=AdminDateWidget)
  9. class Meta:
  10. model = Project
  11. # fields = '__all__'
  12. exclude = ('pid',)
  13. class VolunteerForm(ModelForm):
  14. choice = ChoiceField(choices=TYPE_CHOICES, widget=RadioSelect,
  15. label='Was möchtest Du beantragen?')
  16. check = BooleanField(required=True,
  17. label=format_html("Ich stimme den <a href='{}'>Datenschutzbestimmungen</a> und den <a href='{}'>Förderrichtlinen</a> zu",
  18. DATAPROTECTION, FOERDERRICHTLINIEN))
  19. class Meta:
  20. model = Volunteer
  21. exclude = ('granted',)
  22. class LibraryForm(ModelForm):
  23. class Meta:
  24. model = Library
  25. exclude = ('realname', 'email', 'username', 'type', 'granted')
  26. class IFGForm(ModelForm):
  27. class Meta:
  28. model = IFG
  29. exclude = ('realname', 'email', 'username')