Switch to unified view

a/OSSEval/analysis/views.py b/OSSEval/analysis/views.py
...
...
5
from django.template import RequestContext
5
from django.template import RequestContext
6
from django.utils import simplejson, timezone
6
from django.utils import simplejson, timezone
7
from django.views.generic import ListView
7
from django.views.generic import ListView
8
from xml.dom import minidom
8
from xml.dom import minidom
9
9
10
from forms import AnalysisForm, UploadFileForm, ImportChoice, MyModelForm
10
from forms import AnalysisForm, UploadFileForm, ImportChoice
11
from analysis.models import Analysis, Instance, UploadedFile, Answer, Methodology, MethodologyVersion, Question, Page
11
from analysis.models import Analysis, Instance, UploadedFile, Answer, Methodology, MethodologyVersion, Question, Page
12
#from methodology.models import Methodology, MethodologyVersion, Question, Page
12
#from methodology.models import Methodology, MethodologyVersion, Question, Page
13
from OSSEval.utils import xmlMinidom, TrivialJSONEncoder, SearchEngine
13
from OSSEval.utils import xmlMinidom, TrivialJSONEncoder, SearchEngine
14
14
15
def analysis_new(request, analysis_id=0):
15
def analysis_new(request, analysis_id=0):
...
...
226
    else:
226
    else:
227
        a.id = analysis_xml.attributes["Id"].firstChild.data
227
        a.id = analysis_xml.attributes["Id"].firstChild.data
228
        return HttpResponseRedirect(reverse('analysis_list'))
228
        return HttpResponseRedirect(reverse('analysis_list'))
229
229
230
230
231
def create_a_my_model(request):
232
    if request.method == 'POST':
233
        form = MyModelForm(request.POST)
234
        if form.is_valid():
235
            # save the model to database, directly from the form:
236
            my_model = form.save()  # reference to my_model is often not needed at all, a simple form.save() is ok
237
            # alternatively:
238
            # my_model = form.save(commit=False)  # create model, but don't save to database
239
            # my.model.something = whatever  # if I need to do something before saving it
240
            # my.model.save()
241
    else:        
242
        form = MyModelForm()
243
    c = { 'form' : form }
244
    return render(request, 'analysis/template.html', c)