Parent: [853210] (diff)

Child: [831432] (diff)

Download this file

forms.py    44 lines (35 with data), 1.9 kB

 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
# This Source Code Form of OSSEval is subject to the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE, v. 3.0. If a copy of the AGPL was not
# distributed with this file, You can obtain one at http://www.gnu.org/licenses/agpl.txt
#
# OSSeval is powered by the SOS Open Source AGPL edition.
# The AGPL requires that you do not remove the SOS Open Source attribution and copyright
# notices from the user interface (see section 5.d below).
# Commercial licenses are available and do not require any SOS Open Source attributions
# or visible copyright notices but they are not permitted under this license.
# OSSEval Copyright 2014 Bitergium SLL
# SOS Open Source Copyright 2012 Roberto Galoppini
# Author: Davide Galletti
from django.forms import ModelForm, Textarea, HiddenInput
from django import forms
from django.forms.widgets import RadioSelect
from models import Analysis
class AnalysisForm(ModelForm):
class Meta:
model = Analysis
fields = '__all__' #('name', 'description', 'comment', 'weight_scenario')
# fields = ('id', 'name', 'description', 'comment', 'user_login', 'methodology_version')
widgets = {
'description': Textarea(attrs={'cols': 80, 'rows': 5}),
'comment': Textarea(attrs={'cols': 80, 'rows': 5}),
'id': HiddenInput()
}
class UploadFileForm(forms.Form):
file = forms.FileField(label='Select a file')
class ImportChoice(forms.Form):
HOW_TO_IMPORT = [['0','Update if ID exists, create if ID is empty or non existent'],['1','Always create new records']]
how_to_import = forms.ChoiceField( widget=RadioSelect(), choices=HOW_TO_IMPORT)
import_methodology = forms.BooleanField()
import_analysis = forms.BooleanField()
uploaded_file_id = forms.CharField(widget=forms.HiddenInput())
new_uploaded_file_relpath = forms.CharField(widget=forms.HiddenInput())