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.

61 lines
2.1 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', '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','survey_mail_send')
  23. INTERN_CHOICES = [('PRO', 'Projektsteckbrief'),
  24. ('HON', 'Ehrenamtsbescheinigung'),
  25. ('AKK', 'Akkreditierung oder Redaktionsbestätigung'),
  26. ('TRAV', 'Reisekostenerstattung')]
  27. class InternForm(ModelForm):
  28. choice = ChoiceField(choices = INTERN_CHOICES, widget=RadioSelect,
  29. label = 'Was möchtest Du eingeben?')
  30. class Meta:
  31. model = Volunteer
  32. exclude = ('granted','survey_mail_send')
  33. class LibraryForm(ModelForm):
  34. class Meta:
  35. model = Library
  36. exclude = ('realname', 'email', 'username', 'type', 'granted', 'survey_mail_send')
  37. class IFGForm(ModelForm):
  38. class Meta:
  39. model = IFG
  40. exclude = ('realname', 'email', 'username', 'granted', 'survey_mail_send')
  41. class HonoraryCertificateForm(ModelForm):
  42. class Meta:
  43. model = HonoraryCertificate
  44. exclude = ('realname', 'email', 'username', 'granted', 'survey_mail_send')