Exemple #1
0
def overtime_list(request):

    if not request.user.is_authenticated():
        raise PermissionDenied

    page_number = 1
    try:
        page_number = int(request.GET["p"])
    except:
        pass

    qs = OvertimeEntry.objects
    qs = qs.filter(user=request.user.id).exclude(status=STATUS_CANCEL)
    qs = qs.order_by("-pub_date")

    pagination = generate_pagination(request, qs, 30)

    for obj in pagination.page.object_list:
        obj.minutes = round(
            (obj.end_time - obj.start_time).total_seconds() / 60.0, 2)
        obj.status_name = status_to_text(obj.status)

    return TemplateResponse(request, "attendance/overtime_list.html", {
        "pagination": pagination,
    })
Exemple #2
0
def leader_audit_list(request):

    if not request.user.is_authenticated():
        raise PermissionDenied

    page_number = 1
    try:
        page_number = int(request.GET["p"])
    except:
        pass

    staff_entries = list(
        StaffRelatedEntry.objects.filter(user_id=request.user.id).all())
    staff_user_ids = [s.staff_user_id for s in staff_entries]
    print "staff_user_ids", staff_user_ids

    qs = OvertimeEntry.objects
    qs = qs.filter(status=STATUS_WAIT)
    #qs = qs.exclude(user_id=request.user.id)
    qs = qs.filter(user_id__in=staff_user_ids)
    #qs = qs.exclude(status=STATUS_CANCEL)
    qs = qs.order_by("-pub_date")

    pagination = generate_pagination(request, qs, 30)

    for obj in pagination.page.object_list:
        obj.minutes = round(
            (obj.end_time - obj.start_time).total_seconds() / 60.0, 2)
        obj.status_name = status_to_text(obj.status)

    return TemplateResponse(request, "attendance/leader_audit.html", {
        "pagination": pagination,
    })
Exemple #3
0
def leader_audit_list(request):

  if not request.user.is_authenticated():
    raise PermissionDenied
  
  page_number = 1
  try:
    page_number = int(request.GET["p"])
  except:
    pass


  staff_entries = list(StaffRelatedEntry.objects.filter(user_id=request.user.id).all())
  staff_user_ids = [s.staff_user_id for s in staff_entries]
  print "staff_user_ids", staff_user_ids

  qs = OvertimeEntry.objects
  qs = qs.filter(status=STATUS_WAIT)
  #qs = qs.exclude(user_id=request.user.id)
  qs = qs.filter(user_id__in=staff_user_ids)
  #qs = qs.exclude(status=STATUS_CANCEL)
  qs = qs.order_by("-pub_date")


  pagination = generate_pagination(request, qs, 30)
  
  for obj in pagination.page.object_list:
     obj.minutes = round((obj.end_time - obj.start_time).total_seconds() / 60.0, 2)
     obj.status_name = status_to_text(obj.status)


  return TemplateResponse(request, "attendance/leader_audit.html", {
    "pagination": pagination,
    })
Exemple #4
0
def takeleave_audit_list(request):
  if not request.user.is_authenticated():
    raise PermissionDenied
  page_number = 1
  try:
    page_number = int(request.GET["p"])
  except:
    pass

  qs = get_user_takeleave_queryset(request.user.id)

  pagination = generate_pagination(request, qs, 30)

  for obj in pagination.page.object_list:
    obj.minutes = round((obj.end_time - obj.start_time).total_seconds() / 60.0, 2)
    obj.status_name = status_to_text(obj.status)

  return TemplateResponse(request, "attendance/takeleave_audit.html",{
    "pagination": pagination,
  })
Exemple #5
0
def takeleave_audit_list(request):
    if not request.user.is_authenticated():
        raise PermissionDenied
    page_number = 1
    try:
        page_number = int(request.GET["p"])
    except:
        pass

    qs = get_user_takeleave_queryset(request.user.id)

    pagination = generate_pagination(request, qs, 30)

    for obj in pagination.page.object_list:
        obj.minutes = round(
            (obj.end_time - obj.start_time).total_seconds() / 60.0, 2)
        obj.status_name = status_to_text(obj.status)

    return TemplateResponse(request, "attendance/takeleave_audit.html", {
        "pagination": pagination,
    })
Exemple #6
0
def takeleave_list(request):
  if not request.user.is_authenticated():
    raise PermissionDenied

  page_number = 1
  try:
    page_number = int(request.GET["p"])
  except:
    pass

  qs = TakeleaveEntry.objects
  qs = qs.filter(user=request.user.id).exclude(status=STATUS_CANCEL)
  qs = qs.order_by("-pub_date")

  pagination = generate_pagination(request, qs, 30)

  for obj in pagination.page.object_list:
    obj.minutes = round((obj.end_time - obj.start_time).total_seconds() / 60.0, 2)
    obj.status_name = status_to_text(obj.status)

  return TemplateResponse(request, "attendance/takeleave_list.html", {
    "pagination": pagination,
  })