--- a/OSSEval/analysis/forms.py
+++ b/OSSEval/analysis/forms.py
@@ -17,15 +17,20 @@
from models import Analysis
class AnalysisForm(ModelForm):
+ def __init__(self, data=None, *args, **kwargs):
+ super(AnalysisForm, self).__init__(data, *args, **kwargs)
+ if 'instance' in kwargs.keys():
+ self._meta.widgets['methodology_version'] = HiddenInput() ###NON FUNZIONA!!!
class Meta:
model = Analysis
- fields = '__all__' #('name', 'description', 'comment', 'weight_scenario')
+# fields = '__all__' #('name', 'description', 'comment', 'weight_scenario')
-# fields = ('id', 'name', 'description', 'comment', 'user_login', 'methodology_version')
+ fields = ('id', 'name', 'description', 'comment', 'created', 'user_login', 'methodology_version', 'weight_scenario')
widgets = {
'description': Textarea(attrs={'cols': 80, 'rows': 5}),
'comment': Textarea(attrs={'cols': 80, 'rows': 5}),
- 'id': HiddenInput()
+ 'id': HiddenInput(),
+ 'weight_scenario': HiddenInput()
}
class UploadFileForm(forms.Form):
@@ -35,7 +40,7 @@
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)
+ how_to_import = forms.ChoiceField( widget=RadioSelect(), choices=HOW_TO_IMPORT, required=True)
import_methodology = forms.BooleanField()
import_analysis = forms.BooleanField()
uploaded_file_id = forms.CharField(widget=forms.HiddenInput())