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.

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