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.

65 lines
2.3 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, Extern, IFG, Library, TYPE_CHOICES, HonoraryCertificate, Travel
  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', 'realname', 'email', 'project_end_mail', 'survey_mail_send')
  12. widgets = {'start': AdminDateWidget(),
  13. 'end': AdminDateWidget(),}
  14. class ExternForm(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 = Extern
  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 TravelForm(ModelForm):
  33. class Meta:
  34. model = Travel
  35. exclude = ('granted', 'granted_date', 'survey_mail_send', 'realname', 'email',)
  36. class LibraryForm(ModelForm):
  37. class Meta:
  38. model = Library
  39. exclude = ('realname', 'email', 'username', 'type', 'granted', 'granted_date', 'survey_mail_send')
  40. class IFGForm(ModelForm):
  41. class Meta:
  42. model = IFG
  43. exclude = ('realname', 'email', 'username', 'granted', 'granted_date', 'survey_mail_send')
  44. class HonoraryCertificateForm(ModelForm):
  45. class Meta:
  46. model = HonoraryCertificate
  47. exclude = ('realname', 'email', 'username', 'granted', 'granted_date', 'survey_mail_send')