예제 #1
0
파일: views.py 프로젝트: herlo/scalereg
def CheckIn(request):
  can_access = reports_perm_checker(request.user, request.path)
  if not can_access:
    return HttpResponseRedirect('/accounts/profile/')

  if request.method == 'GET':
    return render_to_response('reg6/staff/checkin.html',
      {'title': 'Attendee Check In',
      })

  attendees = []
  if request.POST['last_name']:
    attendees = models.Attendee.objects.filter(valid=True,
      last_name__icontains=request.POST['last_name'])
  if not attendees:
    attendees = models.Attendee.objects.filter(valid=True,
      zip=request.POST['zip'])

  return render_to_response('reg6/staff/checkin.html',
    {'title': 'Attendee Check In',
     'attendees': attendees,
     'last': request.POST['last_name'],
     'zip': request.POST['zip'],
     'search': 1,
    })
예제 #2
0
파일: views.py 프로젝트: herlo/scalereg
def FinishCheckIn(request):
  can_access = reports_perm_checker(request.user, request.path)
  if not can_access:
    return HttpResponseRedirect('/accounts/profile/')

  if request.method != 'POST':
    return HttpResponseRedirect('/reg6/')

  if 'id' not in request.POST:
    return render_to_response('error.html',
      {'error_message': 'No ID'})

  try:
    attendee = models.Attendee.objects.get(id=request.POST['id'])
  except models.Attendee.DoesNotExist:
    return render_to_response('error.html',
      {'error_message': 'We could not find your registration'})

  try:
    attendee.checked_in = True
    attendee.save()
  except:
    return render_to_response('error.html',
      {'error_message': 'We encountered a problem with your checkin'})

  return render_to_response('reg6/staff/finish_checkin.html',
    {'title': 'Attendee Check In',
     'attendee': attendee,
    })
예제 #3
0
파일: views.py 프로젝트: herlo/scalereg
def index(request):
  can_access = reports_perm_checker(request.user, request.path)
  if not can_access:
    return HttpResponseRedirect('/accounts/profile/')
  return render_to_response('reg6/staff/index.html',
    {'title': 'Staff Page',
    })
예제 #4
0
파일: views.py 프로젝트: herlo/scalereg
def CashPayment(request):
  can_access = reports_perm_checker(request.user, request.path)
  if not can_access:
    return HttpResponseRedirect('/accounts/profile/')

  tickets = []
  try:
    tickets.append(models.Ticket.objects.get(name='7XSVN'))
  except:
    pass
  try:
    tickets.append(models.Ticket.objects.get(name='OSSE'))
  except:
    pass
  try:
    tickets.append(models.Ticket.objects.get(name='WIOS'))
  except:
    pass
  try:
    tickets.append(models.Ticket.objects.get(name='6XE1'))
  except:
    pass
  try:
    tickets.append(models.Ticket.objects.get(name='6XF2'))
  except:
    pass
  try:
    tickets.append(models.Ticket.objects.get(name='7XSTD'))
  except:
    pass
  try:
    tickets.append(models.Ticket.objects.get(name='7XKID'))
  except:
    pass
  try:
    tickets.append(models.Ticket.objects.get(name='T1'))
  except:
    pass

  if request.method == 'GET':
    return render_to_response('reg6/staff/cash.html',
      {'title': 'Cash Payment',
       'tickets': tickets,
      })

  for var in ['FIRST', 'LAST', 'EMAIL', 'ZIP', 'TICKET']:
    if var not in request.POST:
      return render_to_response('error.html',
        {'error_message': 'missing data: no %s field' % var})

  try:
    ticket = models.Ticket.objects.get(name=request.POST['TICKET'])
  except:
    return render_to_response('error.html',
      {'error_message': 'cannot find ticket type'})

  order = models.Order()
  bad_order_nums = [ x.order_num for x in models.TempOrder.objects.all() ]
  bad_order_nums += [ x.order_num for x in models.Order.objects.all() ]
  order.order_num = GenerateOrderID(bad_order_nums)
  assert order.order_num
  order.valid = True
  order.name = '%s %s' % (request.POST['FIRST'], request.POST['LAST'])
  order.address = 'Cash'
  order.city = 'Cash'
  order.state = 'Cash'
  order.zip = request.POST['ZIP']
  order.email = request.POST['EMAIL']
  order.payment_type = 'cash'
  order.amount = ticket.price

  attendee = models.Attendee()
  attendee.first_name = request.POST['FIRST']
  attendee.last_name = request.POST['LAST']
  attendee.zip = request.POST['ZIP']
  attendee.email = request.POST['EMAIL']
  attendee.valid = True
  attendee.checked_in = True
  attendee.can_email = True
  attendee.order = order
  attendee.badge_type = ticket
  invalid = attendee.validate()
  if invalid:
    return render_to_response('error.html',
      {'error_message': 'cannot save attendee, bad data?'})
  try:
    order.save()
  except: # FIXME catch the specific db exceptions
    return render_to_response('error.html',
      {'error_message': 'cannot save order, bad data?'})
  attendee.save()

  return render_to_response('reg6/staff/cash.html',
    {'title': 'Cash Payment',
     'success': True,
     'tickets': tickets,
    })