forked from shiyunbo/django-smartdoc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforms.py
53 lines (40 loc) · 1.38 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
52
from django.forms import ModelForm, TextInput, FileInput, Select
from .models import Product, Category, Document
class ProductForm(ModelForm):
class Meta:
model = Product
exclude = ('author', 'create_date', 'mod_date')
widgets = {
'name': TextInput(attrs={'class': 'form-control'}),
'code': TextInput(attrs={'class': 'form-control'}),
}
labels = {
'name': '产品名称',
'code': '产品代码',
}
class CategoryForm(ModelForm):
class Meta:
model = Category
exclude = ('author', 'create_date', 'mod_date')
widgets = {
'name': TextInput(attrs={'class': 'form-control'}),
}
labels = {
'name': '类别',
}
class DocumentForm(ModelForm):
class Meta:
model = Document
exclude = ('author', 'create_date', 'mod_date', 'product')
widgets = {
'title': TextInput(attrs={'class': 'form-control'}),
'version_no': TextInput(attrs={'class': 'form-control'}),
'category': Select(attrs={'class': 'form-control'}),
'doc_file': FileInput(attrs={'class': 'form-control'}),
}
labels = {
'title': '文档标题',
'version_no': '版本号',
'category': '文档类别',
'doc_file': '上传文件',
}