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
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. # 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. INTERN_CHOICES = [('PRO', 'Projektsteckbrief'),
  23. ('HON', 'Eherenamtsbescheinigung'),
  24. ('AKK', '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',)
  32. class LibraryForm(ModelForm):
  33. class Meta:
  34. model = Library
  35. exclude = ('realname', 'email', 'username', 'type', 'granted')
  36. class IFGForm(ModelForm):
  37. class Meta:
  38. model = IFG
  39. exclude = ('realname', 'email', 'username', 'granted')
  40. class HonoraryCertificateForm(ModelForm):
  41. class Meta:
  42. model = HonoraryCertificate
  43. exclude = ('realname', 'email', 'username', 'granted')