Ejemplo n.º 1
0
def decline(request, id, slug, hash):
        '''
		Handle links sent to email to decline registration
		and set proper status for the record.
	'''
	event = get_object_or_404(Event, pk=id, active=True)
        registration = get_object_or_404(Registration, hash=hash)
        
	prevStatus = registration.status
	registration.status = "Declined"
        registration.save()
	
	#We release a place for the next one in queue and send him and email
	# but only if his previous status was Confirmed or Pending
	# FIXME: I'm sure there is a better way to do this
	if event.queueActive and prevStatus == "Confirmed" or prevStatus == "Pending":
		nextInQueueId = Registration.objects.filter(event=event.id, status="Queued").order_by('creationDate')[:1]
		if nextInQueueId:
			nextInQueue = Registration.objects.get(pk=nextInQueueId[0].id)
			nextInQueue.status = "Pending"
			nextInQueue.save()
			#Email confirmation
			pendingMail(event.id, nextInQueue.id)
        
        data = {
            'registration': registration,
	    'event': event
        }

        return render_to_response('events/registration-declined.html', data, context_instance=RequestContext(request))
Ejemplo n.º 2
0
def decline(request, id, slug, hash):
    """
    Handle links sent to email to decline registration
    and set proper status for the record.
    """
    event = get_object_or_404(Event, pk=id, active=True)
    registration = get_object_or_404(Registration, hash=hash)

    prevStatus = registration.status
    registration.status = "Declined"
    registration.save()

    # We release a place for the next one in queue and send him and email
    # but only if his previous status was Confirmed or Pending
    # FIXME: I'm sure there is a better way to do this
    if (event.queueActive and prevStatus == "Confirmed" or
        prevStatus == "Pending"):

        nextInQueueId = Registration.objects.filter(
            event=event.id, status="Queued").order_by('creationDate')[:1]

        if nextInQueueId:
            nextInQueue = Registration.objects.get(pk=nextInQueueId[0].id)
            nextInQueue.status = "Pending"
            nextInQueue.save()
            # Email confirmation
            pendingMail(event.id, nextInQueue.id)

    data = {
        'registration': registration,
        'event': event
    }

    return render_to_response(
        'events/registration-declined.html',
        data,
        context_instance=RequestContext(request))
Ejemplo n.º 3
0
def reg_pending(modeladmin, request, queryset):
    queryset.update(status="Pending")
    
    for obj in queryset:
	pendingMail(obj.event.id, obj.id)
Ejemplo n.º 4
0
def reg_pending(modeladmin, request, queryset):
    queryset.update(status="Pending")

    for obj in queryset:
        pendingMail(obj.event.id, obj.id)