Exemplo n.º 1
0
def note(request, project):
    if request.method == 'POST':

        
        Note_id = Note.objects.filter(project_id=project).filter(note_id=request.POST.get("note_id", ""))
        if Note_id.count() > 0:
            n = Note_id.get(newest=True)
            n.newest = False
            n.save()





        Title = request.POST.get("title", "")
        Comment = request.POST.get("comment", "")
        Project_id  = request.POST.get("project_id", "")
        Date = request.POST.get("date", "")
        ID = request.POST.get("note_id", "")

    #create new note           
        new_note = Note(title=Title, comment=Comment, project_id=Project_id, date=Date, note_id=ID, newest=True)
        new_note.save()

    project_id = Project.objects.filter(project_id=project).latest('timestamp').pk
    note = Note.objects.filter(project_id=project).filter(newest=True)
    note_num = note.count()
    p = Project.objects.get(pk=project_id)


    context_instance=RequestContext(request,{
            'p' : p,
            'note' : note,
            'num' : note_num,
        })

    return render_to_response('Models/notetable.html', context_instance)                                                                                                                                                         


    project_id = Project.objects.filter(project_id=project).latest('timestamp').pk
    note = Note.objects.filter(project_id=project).filter(newest=True)
    p = Project.objects.get(pk=project_id)
    
    context_instance=RequestContext(request,{
            'p' : p,
            'note' : note,
        })

    return render_to_response('Models/notetable.html', context_instance)
Exemplo n.º 2
0
 def post(self):
     data = note_parser.parse_args()
     mobilizee_id = data["mobilizee_id"]
     note_content = data["note"]
     note = Note(mobilizee_id, note_content)
     mobilizee = db.session.query(Mobilizee).get(mobilizee_id)
     mobilizee.notes.append(note)
     db.session.commit()
     return {"Message": "Note appended"}
Exemplo n.º 3
0
def projects(request, project):
    
    #If a new issue has been added, it refreshes the page. In doing so, it adds
    #a new issue. 
    if request.POST.get("type", "")  == "issue":
        Title = request.POST.get("title", "")
        Category = request.POST.get("category", "")
        Severity = request.POST.get("severity", "")
        Comment = request.POST.get("comment", "")
        Open_date = request.POST.get("opendate", "")
        Assigned_to = request.POST.get("assignedto", "")
        Next_step = request.POST.get("next_step", "")
        External_dependencies = request.POST.get("externdepend", "")
        Project_id  = request.POST.get("project_id", "")
        IID = request.POST.get("num", "")
        
        new_issue = Issue(title=Title, category=RI_Category.objects.get(ri_category=Category), 
                        severity=Health.objects.get(health=Severity), comment=Comment,
                        project_id=Project_id, open_date=Open_date, close_date="9999-12-12", 
                        assign_to=Assigned_to, next_step=Next_step, 
                        external_dependencies=External_dependencies, issue_id=IID, newest=True)
        new_issue.save()

    #If a new milestone has been added, it refreshes the page. In doing so,
    #it adds a new milestone. 
    if request.POST.get("type", "")  == "milestone": 
        Title = request.POST.get("title", "")
        Comment = request.POST.get("description", "")
        Project_id  = request.POST.get("project_id", "")
        STATUS = request.POST.get("severity", "")
        Baseline_date = request.POST.get("basedate", "")
        Target_date = request.POST.get("targetdate", "")
        Mile_type = request.POST.get("miletype", "")
        ID = request.POST.get("num", "")
        
    #create new milestone                                                                                                                                                                                    
        new_milestone = Milestone(title=Title, comment=Comment, project_id=Project_id,
                                 status = Status.objects.get(status=STATUS),baseline_date=Baseline_date, 
                                 target_date=Target_date,  mile_type=Mile_type, milestone_id=ID, newest=True)
        new_milestone.save()


    #If a new note has been added, it refreshes the page. In doing so, it adds
    #a new note.     
    if request.POST.get("type", "")  == "note":                                                                                                                                                              
        Title = request.POST.get("title", "")
        Comment = request.POST.get("text", "")
        Project_id  = request.POST.get("project_id", "")
        Date = request.POST.get("date", "")
        ID = request.POST.get("num", "")

    #create new note                                                                                                                                                                                                      
        new_note = Note(title=Title, comment=Comment, project_id=Project_id, date=Date, note_id=ID, newest=True)
        new_note.save()


    #If a new risk has been added, it refreshes the page. In doing so, it adds
    #a new risk. 
    if request.POST.get("type", "")  == "risk":                                                                                                                                                             
        Title = request.POST.get("title", "")
        Category = request.POST.get("category", "")
        Severity = request.POST.get("severity", "")
        Probability = request.POST.get("probability", "")
        Comment = request.POST.get("comment", "")
        Open_date = request.POST.get("opendate", "")
        Assigned_to = request.POST.get("assignedto", "")
        Next_step = request.POST.get("next_step", "")
        External_dependencies = request.POST.get("externdepend", "")
        Project_id  = request.POST.get("project_id", "")
        RID = request.POST.get("num", "")

        new_risk = Risk(title=Title, category=RI_Category.objects.get(ri_category=Category), 
                        probability=Level.objects.get(level=Probability), severity=Health.objects.get(health=Severity), 
                        comment=Comment, project_id=Project_id, open_date=Open_date, close_date="9999-12-12", 
                        assigned_to=Assigned_to, next_step=Next_step, external_dependencies=External_dependencies, risk_id=RID, newest=True)
        new_risk.save()
        

    project_id = Project.objects.filter(project_id=project).latest('timestamp').pk
    p = Project.objects.get(pk=project_id)
    
    #Get issue objects and orders them by date
    issues = Issue.objects.filter(project_id=project).filter(newest=True).order_by('-timestamp')
    issues_recent = issues.filter(timestamp__gt= timezone.now() - datetime.timedelta(days=1))
    
    #Get milestone objects and orders them by date
    milestone = Milestone.objects.filter(project_id=project).filter(newest=True).order_by('-timestamp')
    milestone_recent = milestone.filter(timestamp__gt= timezone.now() - datetime.timedelta(days=1))

    #Get note objects and orders them by date
    note = Note.objects.filter(project_id=project).filter(newest=True).order_by('-timestamp')
    note_recent = note.filter(timestamp__gt= timezone.now() - datetime.timedelta(days=1))

    #Get risk objects and orders them by date
    risk = Risk.objects.filter(project_id=project).filter(newest=True).order_by('-timestamp')
    risk_recent = risk.filter(timestamp__gt= timezone.now() - datetime.timedelta(days=1))

    #Get role objects
    personnel = Personnel.objects.filter(project_id=project).filter(active=True)


    #Get number of items
    issue_num = issues.count()
    milestone_num = milestone.count()
    note_num = note.count()
    risk_num = risk.count()

    #Change status of project if the status is changed from the profile page
    if request.POST.get("status", "") != "":
        status = request.POST.get("status", "")
        p.status = Status.objects.get(status=status)
        p.save()

    gstatus = Status.objects.get(status="Active - Green")
    ystatus = Status.objects.get(status="Active - Yellow")
    rstatus = Status.objects.get(status="Active - Red")
    
    #Gets list of Gate Review dates and similar milestones
    mile_type = Milestone.objects.filter(project_id=p.project_id).exclude(mile_type="Other")
    
    # List of all ri_categories
    category = RI_Category.objects.all()
    
    #  compliance = category.get(ri_category="compliance")
    context_instance=RequestContext(request,
                      {'issues' : issues,
                       'p' : p,
                       'milestone' : milestone,
                       'note' : note,
                       'risk' : risk,
                       'personnel' : personnel,
                       'issues_recent' : issues_recent,
                       'milestone_recent' : milestone_recent,
                       'note_recent' : note_recent,
                       'risk_recent' : risk_recent,
                       'milestone_num' : milestone_num,
                       'note_num' : note_num,
                       'risk_num' : risk_num,
                       'issue_num' : issue_num,
                       'gstatus' : gstatus,
                       'ystatus' : ystatus,
                       'rstatus' : rstatus,
                       'mile_type' : mile_type,
                       'compliance' : category.get(ri_category="Compliance"), 
                       'cost' : category.get(ri_category="Cost"),
                       'dependency' : category.get(ri_category="Dependency"),
                       'info_assurance' :category.get(ri_category="Info Assurance"),
                       'organizational' :category.get(ri_category="Organizational"),
                       'privacy' :category.get(ri_category="Privacy"),
                       'resources' :category.get(ri_category="Resources"),
                       'schedule' :category.get(ri_category="Schedule"),
                       'security' : category.get(ri_category="Security"),
                       'strategic' :category.get(ri_category="Strategic"),
                       'scope' :category.get(ri_category="Scope"),
                       'technical' :category.get(ri_category="Technical"),
                       
                       })

    return render_to_response('Models/profile.html', context_instance)