コード例 #1
0
ファイル: views.py プロジェクト: mmccarty/nell
def export_proposals(request, *args, **kws):
    if request.method == 'POST':
        astrid = request.POST.get('astrid', 'false') == 'true'
        proposals = request.POST.getlist('proposals')
        DssExport(quiet = True).exportProposals(proposals)
        if astrid:
            astridDB = AstridDB(dbname = None, quiet = True)
            astridDB.addProjects(proposals)
    return HttpResponse(json.dumps({"success" : "ok"})
                      , content_type = 'application/json')
コード例 #2
0
ファイル: views.py プロジェクト: mmccarty/nell
def export_semester(request, *args, **kws):
    if request.method == 'POST':
        astrid = request.POST.get('astrid', 'false') == 'true'
        semester = request.POST.get('semester')
        if semester is not None:
            proposals = [p.pcode
                         for p in Proposal.objects.filter(
                           semester__semester = semester)
                         if p.allocatedTime() > 0]
            DssExport(quiet = True).exportProposals(proposals)
            if astrid:
                astridDB = AstridDB(dbname = None, quiet = True)
                astridDB.addProjects(proposals)

    return HttpResponse(json.dumps({"success" : "ok"})
                      , content_type = 'application/json')