def ajax_reject_report_submission(request): if request.method == 'POST': report_submission_id = request.POST['id'] report_submission = ReportSubmission.objects.get(pk=report_submission_id) report_submission.state = REJECTED_ACTIVITY report_submission.approval_on = datetime.now() report_submission.save() return HttpResponse(simplejson.dumps({'timestamp':format_abbr_datetime(report_submission.approval_on)})) else: raise Http404
def display_report_sending_notice(submission): if submission.this_is == 'overdue': return unicode('<div class="notice overdue">เลขกำหนดส่งมาแล้ว ', 'utf-8') + utilities.week_elapse_text( submission.schedule_date) + '</div>' elif submission.this_is == 'waiting': return unicode( '<div class="notice waiting">กำลังรอการอนุมัติรายงาน</div>', 'utf-8') elif submission.this_is == 'rejected': return unicode( '<div class="notice rejected">รายงานถูกตีกลับเมื่อวันที่ ', 'utf-8') + utilities.format_abbr_datetime( submission.approval_date) + '</div>' return ''
def ajax_reject_report_submission(request): if request.method == 'POST': report_submission_id = request.POST['id'] report_submission = ReportSubmission.objects.get( pk=report_submission_id) report_submission.state = REJECTED_ACTIVITY report_submission.approval_on = datetime.now() report_submission.save() return HttpResponse( simplejson.dumps({ 'timestamp': format_abbr_datetime(report_submission.approval_on) })) else: raise Http404
def display_report_sending_notice(submission): if submission.this_is == 'overdue': return unicode('<div class="notice overdue">เลขกำหนดส่งมาแล้ว ', 'utf-8') + utilities.week_elapse_text(submission.schedule_date) + '</div>' elif submission.this_is == 'waiting': return unicode('<div class="notice waiting">กำลังรอการอนุมัติรายงาน</div>', 'utf-8') elif submission.this_is == 'rejected': return unicode('<div class="notice rejected">รายงานถูกตีกลับเมื่อวันที่ ', 'utf-8') + utilities.format_abbr_datetime(submission.approval_date) + '</div>' return ''
def abbr_datetime(datetime): return utilities.format_abbr_datetime(datetime)