-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathforms.py
executable file
·51 lines (46 loc) · 1.39 KB
/
forms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from django import forms
from django.core.validators import FileExtensionValidator
from web.models import *
class RequestForm(forms.ModelForm):
class Meta:
model = Request
fields = [
'input_file',
'email',
'max_context_lines'
]
# widgets = {
# 'input_file': forms.FileInput(),
# 'email': forms.TextInput(
# attrs={
# 'class': 'form-control',
# 'name': 'email',
# 'placeholder': 'Email'
# }
# )
# }
# class RequestForm(forms.ModelForm):
# input_file = forms.FileField(
# label='Input File',
# widget=forms.FileInput(),
# validators=[FileExtensionValidator(allowed_extensions=(['txt', 'zip']))]
# )
# conf_file = forms.FileField(
# label='Configuration File',
# widget=forms.FileInput()
# )
# email = forms.EmailField(
# max_length=64,
# label='Email Address',
# widget=forms.TextInput(
# attrs={
# 'class': 'form-control',
# 'name': 'email',
# 'placeholder': 'Email'
# }
# )
# )
# def clean(self):
# cleaned_data = super(RequestForm, self).clean()
# # email = self.cleaned_data.get('email')
# return cleaned_data