forked from k1nd0ne/VolWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforms.py
32 lines (26 loc) · 1.78 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
from django import forms
from .models import Symbols
from investigations.models import UploadInvestigation
from django.forms import ModelForm, TextInput, Textarea, Select, FileInput
#This ModelForm is made to create a new IOC
class SymbolsForm(forms.ModelForm):
class Meta:
model = Symbols
fields = ('name','os','description', 'symbols_file')
widgets = {
'name': TextInput(attrs={'class':'form-control','placeholder': 'Usually the distribution name and kernel version','required':'""'}),
'os': Select(attrs={'class': 'form-control','required':'""'}),
'description' : Textarea(attrs={'class':'form-control','rows':"4",'placeholder':'Detailed information about this ISF','required':'""'}),
'symbols_file' : FileInput(attrs={'class': 'form-control'}),
}
class GetSymbols(forms.Form):
symbols_id = forms.CharField(max_length=100, widget=forms.TextInput(attrs={
'class': 'd-none',}))
class ManageSymbols(forms.Form):
symbols = forms.ModelChoiceField(queryset=Symbols.objects.all(), required=True, widget=forms.TextInput(attrs={'type':'hidden'}))
class BindSymbol(forms.Form):
bind_symbols = forms.ModelChoiceField(queryset=Symbols.objects.all(), required=True, widget=forms.TextInput(attrs={'type':'hidden'}))
bind_investigation = forms.ModelChoiceField(queryset=UploadInvestigation.objects.all(), required=True, widget=forms.Select(attrs={'class': 'form-control'}))
class UnbindSymbol(forms.Form):
unbind_symbols = forms.ModelChoiceField(queryset=Symbols.objects.all(), required=True, widget=forms.TextInput(attrs={'type':'hidden'}))
unbind_investigation = forms.ModelChoiceField(queryset=UploadInvestigation.objects.all(), required=True, widget=forms.Select(attrs={'class': 'form-control'}))