コード例 #1
0
ファイル: views.py プロジェクト: Tingish/_science
def timelikeFormLabbookSave(request):
        if (TimelikeFormLabbook(request.POST, request.FILES).is_valid()):
            tempTimelike = Timelike()
            if (request.POST.get('timelikeFormLinkSource',False)):
                tempTimelike.linkSource = request.POST['timelikeFormLinkSource']
            if (request.FILES.get('timelikeFormLocalSource', False)):
                tempTimelike.localSource = request.FILES['timelikeFormLocalSource']
            tempTimelike.save()
            tempStructureNode = StructureNode()
            tempStructureNode.title = request.POST['timelikeFormTitle']
            tempStructureNode.author = request.user
            tempStructureNode.content_type = ContentType.objects.get_for_model(Timelike)
            tempStructureNode.object_id = tempTimelike.id
            tempStructureNode.isPublished = False
            tempStructureNode.position = getPositionForRoots()
            tempStructureNode.isComment = False
            tempStructureNode.isLabnote = True
            tempStructureNode.save()
            tagList = hashTagParser(request.POST['timelikeFormTag'])
            restrictedTagListSave(request, tempStructureNode, tagList)   
            print("something is valid")
            return True
        else:
            print("nothing is ever valid")
            return False
コード例 #2
0
ファイル: views.py プロジェクト: Tingish/_science
def dataFormLabbookSave(request):
        if (DataFormLabbook(request.POST).is_valid()):
            tempDataset = Dataset()
            tempDataset.data = datasetFormatter(request.POST) 
            tempDataset.save()
            tempStructureNode = StructureNode()
            tempStructureNode.title = request.POST['dataFormTitle']
            tempStructureNode.author = request.user
            tempStructureNode.content_type = ContentType.objects.get_for_model(Dataset)
            tempStructureNode.object_id = tempDataset.id
            tempStructureNode.isPublished = False            
            tempStructureNode.position = getPositionForRoots()
            tempStructureNode.isComment = False
            tempStructureNode.isLabnote = True
            tempStructureNode.save()
            tagList = hashTagParser(request.POST['dataFormTag'])
            restrictedTagListSave(request, tempStructureNode, tagList) 
            print("something is valid")
            return True
        else:
            print("nothing is ever valid data")
            return False
コード例 #3
0
ファイル: views.py プロジェクト: Tingish/_science
def textFormLabbookSave(request):
        if (ParagraphFormLabbook(request.POST).is_valid()):
            tempParagraph = Paragraph()
            tempParagraph.text = request.POST['textFormText'] 
            tempParagraph.save()
            tempStructureNode = StructureNode()
            tempStructureNode.title = request.POST['textFormTitle']
            tempStructureNode.author = request.user
            tempStructureNode.content_type = ContentType.objects.get_for_model(Paragraph)
            tempStructureNode.object_id = tempParagraph.id
            tempStructureNode.isPublished = False
            tempStructureNode.position = getPositionForRoots()
            tempStructureNode.isComment = False
            tempStructureNode.isLabnote = True
            tempStructureNode.save()
            tagList = hashTagParser(request.POST['textFormTag'])
            restrictedTagListSave(request, tempStructureNode, tagList)  
            print("something is valid")
            return True
        else:
            print("nothing is ever valid")
            return False