Esempio n. 1
0
File: views.py Progetto: jMyles/WHAT
def post_task_message(request, service_id):
    '''
    Take a message about a Service instance  Very similar to the view of the same name in the do app.  
    See if the task is complete and mark it so if so.
    If the message field is not blank, send it to the social view to handle the text of the message.
    
    SOGGY AS F**K.
    '''
    service = Service.objects.get(id=service_id)
    task = service.task
    try:
        if request.POST['completed']:
            task.set_status(2, request.user)

    except MultiValueDictKeyError:
        pass  #They didn't mark it completed, no need to think about it further.

    if request.POST['message']:
        post_top_level_message(request, 'do__task__%s' % (task.id))

    if request.POST['service_status']:
        status_object = ServiceStatusPrototype.objects.get(
            id=request.POST['service_status'])
        service.status = status_object
        service.save(creator=request.user)

    return HttpResponseRedirect(service.get_absolute_url())
Esempio n. 2
0
def post_task_message(request, service_id):
    '''
    Take a message about a Service instance  Very similar to the view of the same name in the do app.  
    See if the task is complete and mark it so if so.
    If the message field is not blank, send it to the social view to handle the text of the message.
    
    SOGGY AS F**K.
    '''
    service = Service.objects.get(id=service_id)
    task = service.task
    try:
        if request.POST['completed']:
            task.set_status(2, request.user)

    except MultiValueDictKeyError:
        pass #They didn't mark it completed, no need to think about it further.
    
    if request.POST['message']:
        post_top_level_message(request, 'do__task__%s' % (task.id))
        
    if request.POST['service_status']:
        status_object = ServiceStatusPrototype.objects.get(id=request.POST['service_status'])
        service.status = status_object
        service.save(creator=request.user)
    
    return HttpResponseRedirect(service.get_absolute_url())
Esempio n. 3
0
File: views.py Progetto: jMyles/WHAT
def post_task_message(request, task_id):
    '''
    Take a message about a task.  See if the task is complete and mark it so if so.
    If the message field is not blank, send it to the social view to handle the text of the message.
    '''
    task = Task.objects.get(id=task_id)
    try:
        if request.POST['completed']:
            task.set_status(2, request.user)

    except MultiValueDictKeyError:
        pass  #They didn't mark it completed, no need to think about it further.

    if request.POST['message']:
        post_top_level_message(request, 'do__task__%s' % (task_id))

    return HttpResponseRedirect(task.get_absolute_url())
Esempio n. 4
0
def post_task_message(request, task_id):
    '''
    Take a message about a task.  See if the task is complete and mark it so if so.
    If the message field is not blank, send it to the social view to handle the text of the message.
    '''
    task = Task.objects.get(id=task_id)
    try:
        if request.POST['completed']:
            task.set_status(2, request.user)

    except MultiValueDictKeyError:
        pass #They didn't mark it completed, no need to think about it further.
    
    if request.POST['message']:
        post_top_level_message(request, 'do__task__%s' % (task_id))
    
    return HttpResponseRedirect(task.get_absolute_url())