diff options
Diffstat (limited to 'workshop_app/forms.py')
-rw-r--r-- | workshop_app/forms.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/workshop_app/forms.py b/workshop_app/forms.py index 334bd4e..4bef28c 100644 --- a/workshop_app/forms.py +++ b/workshop_app/forms.py @@ -1,9 +1,11 @@ from string import punctuation, digits from django import forms +from django.forms import inlineformset_factory from django.utils import timezone -from .models import (Profile, Workshop, ProfileComments, department_choices, title, source, states) +from .models import (Profile, Workshop, ProfileComments, department_choices, title, source, states, WorkshopType, + AttachmentFile) try: from string import letters @@ -189,3 +191,25 @@ class ProfileCommentsForm(forms.ModelForm): widgets = { 'comments': forms.CharField(), } + + +class WorkshopTypeForm(forms.ModelForm): + def __init__(self, *args, **kwargs): + super(WorkshopTypeForm, self).__init__(*args, **kwargs) + for field in self.visible_fields(): + field.field.widget.attrs['class'] = 'form-control' + field.field.widget.attrs['placeholder'] = field.label + field.field.widget.attrs['rows'] = 6 + + class Meta: + model = WorkshopType + exclude = [] + + +class AttachmentFileForm(forms.ModelForm): + def __init__(self, *args, **kwargs): + super(AttachmentFileForm, self).__init__(*args, **kwargs) + + class Meta: + model = AttachmentFile + exclude = ['workshop_type'] |