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.

60 lines
2.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, HonoraryCertificate
  6. from .settings import DATAPROTECTION, FOERDERRICHTLINIEN
  7. class ProjectForm(ModelForm):
  8. # start = DateField(widget=AdminDateWidget())
  9. class Meta:
  10. model = Project
  11. exclude = ('pid', 'granted', 'granted_date', 'username', 'realname', 'email', 'project_end_mail', 'survey_mail_send')
  12. widgets = {'start': AdminDateWidget(),
  13. 'end': AdminDateWidget(),}
  14. class VolunteerForm(ModelForm):
  15. choice = ChoiceField(choices=TYPE_CHOICES.items(), widget=RadioSelect,
  16. label='Was möchtest Du beantragen?')
  17. check = BooleanField(required=True,
  18. label=format_html("Ich stimme den <a href='{}'>Datenschutzbestimmungen</a> und den <a href='{}'>Förderrichtlinen</a> zu",
  19. DATAPROTECTION, FOERDERRICHTLINIEN))
  20. class Meta:
  21. model = Volunteer
  22. exclude = ('granted', 'granted_date', 'survey_mail_send')
  23. INTERN_CHOICES = [('PRO', 'Projektsteckbrief'),
  24. ('HON', 'Ehrenamtsbescheinigung, Akkreditierung oder Redaktionsbestätigung'),
  25. ('TRAV', 'Reisekostenerstattung')]
  26. class InternForm(ModelForm):
  27. choice = ChoiceField(choices = INTERN_CHOICES, widget=RadioSelect,
  28. label = 'Was möchtest Du eingeben?')
  29. class Meta:
  30. model = Volunteer
  31. exclude = ('granted', 'granted_date', 'survey_mail_send')
  32. class LibraryForm(ModelForm):
  33. class Meta:
  34. model = Library
  35. exclude = ('realname', 'email', 'username', 'type', 'granted', 'granted_date', 'survey_mail_send')
  36. class IFGForm(ModelForm):
  37. class Meta:
  38. model = IFG
  39. exclude = ('realname', 'email', 'username', 'granted', 'granted_date', 'survey_mail_send')
  40. class HonoraryCertificateForm(ModelForm):
  41. class Meta:
  42. model = HonoraryCertificate
  43. exclude = ('realname', 'email', 'username', 'granted', 'granted_date', 'survey_mail_send')