예제 #1
0
def prepay(request, event_id):
    """
    Prepay to attend an event
    """
    event = get_object_or_404(Event, pk=event_id)

    if not event.can_prepay:
        messages.error(request, "Error: Pre-payments are not accepted.")
        return redirect('event_details', event_id=event_id)

    user_register_count = Attendance.objects.filter(user=request.user,
                                                    event=event).count()

    if user_register_count != 0:
        messages.error(request,
                       "Error: User has already prepaid for this event.")
        return redirect('event_details', event_id=event_id)

    timestamp = timezone.now()
    #timestamp = timestamp.replace(tzinfo=timezone.utc)

    attendance = Attendance(user=request.user,
                            event=event,
                            prepaid=True,
                            date_registered=timestamp)
    attendance.save()
    return redirect('event_details', event_id=event_id)
예제 #2
0
파일: views.py 프로젝트: kurigohan/ems_site
def prepay(request, event_id):
    """
    Prepay to attend an event
    """
    event = get_object_or_404(Event, pk=event_id)

    if not event.can_prepay:
        messages.error(request, "Error: Pre-payments are not accepted.")
        return redirect('event_details', event_id=event_id)

    user_register_count = Attendance.objects.filter(user=request.user, event=event).count()

    if user_register_count != 0:
        messages.error(request, "Error: User has already prepaid for this event.")
        return redirect('event_details', event_id=event_id)

    timestamp = timezone.now()
    #timestamp = timestamp.replace(tzinfo=timezone.utc)

    attendance = Attendance(user=request.user,
                    event=event, 
                    prepaid=True,
                    date_registered=timestamp)
    attendance.save()
    return redirect('event_details', event_id=event_id)
예제 #3
0
def approve_event(request, event_id):
    """
    Set the status of an event reservation to 'approved' and redirect to pending events page
    """
    if not request.user.is_staff:
        raise Http404
    event = get_object_or_404(Event, pk=event_id)
    event.reservation.status = status_const.APPROVED
    event.reservation.save()
    date = timezone.now()
    new_attendee = Attendance(user=event.creator,
                              event=event,
                              prepaid=False,
                              date_registered=date)
    new_attendee.save()

    return redirect('pending_events')
예제 #4
0
파일: views.py 프로젝트: kurigohan/ems_site
def approve_event(request, event_id):
    """
    Set the status of an event reservation to 'approved' and redirect to pending events page
    """
    if not request.user.is_staff:
        raise Http404
    event = get_object_or_404(Event, pk=event_id)
    event.reservation.status = status_const.APPROVED
    event.reservation.save()
    date = timezone.now()
    new_attendee = Attendance(user=event.creator, 
                                                event=event,
                                                prepaid=False,
                                                date_registered=date
                                                )
    new_attendee.save()

    return redirect('pending_events') 
예제 #5
0
파일: views.py 프로젝트: kurigohan/ems_site
def attend(request, event_id):
    """
    Register to attend an event
    """
    event = get_object_or_404(Event, pk=event_id)

    user_register_count = Attendance.objects.filter(user=request.user, event=event).count()

    if user_register_count != 0:
        messages.error(request, "Error: You are already attending this event.")
        return redirect('event_details', event_id=event_id)

    timestamp = timezone.now()
    #timestamp = timestamp.replace(tzinfo=timezone.utc)

    attendance = Attendance(user=request.user,
                    event=event, 
                    prepaid=False,
                    date_registered=timestamp)
    attendance.save()
    return redirect('event_details', event_id=event_id)
예제 #6
0
def attend(request, event_id):
    """
    Register to attend an event
    """
    event = get_object_or_404(Event, pk=event_id)

    user_register_count = Attendance.objects.filter(user=request.user,
                                                    event=event).count()

    if user_register_count != 0:
        messages.error(request, "Error: You are already attending this event.")
        return redirect('event_details', event_id=event_id)

    timestamp = timezone.now()
    #timestamp = timestamp.replace(tzinfo=timezone.utc)

    attendance = Attendance(user=request.user,
                            event=event,
                            prepaid=False,
                            date_registered=timestamp)
    attendance.save()
    return redirect('event_details', event_id=event_id)