Switch to unified view

a/OSSEval/analysis/forms.py b/OSSEval/analysis/forms.py
...
...
15
from django import forms
15
from django import forms
16
from django.forms.widgets import RadioSelect
16
from django.forms.widgets import RadioSelect
17
from models import Analysis
17
from models import Analysis
18
18
19
class AnalysisForm(ModelForm):
19
class AnalysisForm(ModelForm):
20
    def __init__(self, data=None, *args, **kwargs):
21
        super(AnalysisForm, self).__init__(data, *args, **kwargs)
22
        if 'instance' in kwargs.keys():
23
            self._meta.widgets['methodology_version'] = HiddenInput()   ###NON FUNZIONA!!!
20
    class Meta:
24
    class Meta:
21
        model = Analysis
25
        model = Analysis
22
        fields = '__all__' #('name', 'description', 'comment', 'weight_scenario')
26
#         fields = '__all__' #('name', 'description', 'comment', 'weight_scenario')
23
        
27
        
24
#         fields = ('id', 'name', 'description', 'comment', 'user_login', 'methodology_version')
28
        fields = ('id', 'name', 'description', 'comment', 'created', 'user_login', 'methodology_version', 'weight_scenario')
25
        widgets = {
29
        widgets = {
26
            'description': Textarea(attrs={'cols': 80, 'rows': 5}),
30
            'description': Textarea(attrs={'cols': 80, 'rows': 5}),
27
            'comment': Textarea(attrs={'cols': 80, 'rows': 5}),
31
            'comment': Textarea(attrs={'cols': 80, 'rows': 5}),
28
            'id': HiddenInput()
32
            'id': HiddenInput(),
33
            'weight_scenario': HiddenInput()
29
        }
34
        }
30
35
31
class UploadFileForm(forms.Form):
36
class UploadFileForm(forms.Form):
32
    file  = forms.FileField(label='Select a file')
37
    file  = forms.FileField(label='Select a file')
33
    
38
    
34
    
39
    
35
40
36
class ImportChoice(forms.Form):
41
class ImportChoice(forms.Form):
37
    HOW_TO_IMPORT = [['0','Update if ID exists, create if ID is empty or non existent'],['1','Always create new records']]
42
    HOW_TO_IMPORT = [['0','Update if ID exists, create if ID is empty or non existent'],['1','Always create new records']]
38
    how_to_import = forms.ChoiceField( widget=RadioSelect(), choices=HOW_TO_IMPORT)
43
    how_to_import = forms.ChoiceField( widget=RadioSelect(), choices=HOW_TO_IMPORT, required=True)
39
    import_methodology = forms.BooleanField()
44
    import_methodology = forms.BooleanField()
40
    import_analysis = forms.BooleanField()
45
    import_analysis = forms.BooleanField()
41
    uploaded_file_id = forms.CharField(widget=forms.HiddenInput())
46
    uploaded_file_id = forms.CharField(widget=forms.HiddenInput())
42
    new_uploaded_file_relpath = forms.CharField(widget=forms.HiddenInput())
47
    new_uploaded_file_relpath = forms.CharField(widget=forms.HiddenInput())