Пример #1
0
def registration(request, id, slug):
        
        event = get_object_or_404(Event, id=id, active=True)
        
        data = {
                    'event': event,
        }
        
        # If registration is closed, we should display a different page
	if event.registrationOpen is False:
		return render_to_response("events/registration-closed.html", data)
                
        if request.method == "POST":
            
            form = RegistrationForm(request.POST, request.FILES)
            
            if form.is_valid():
                
                registration = form.save(commit=False)
                registration.event = event
                registration.status = "Invited"
                registration.hash = uuid.uuid1().hex
                registration.name = smart_str(registration.firstName) + " " + smart_str(registration.familyName)
                    
                registration.save()
                
                #Email confirmation
                newMail(event.id, registration.id)
		
		data = {
			'event': event,
			'form': form,
			'registration': registration,
                }
                
                return render_to_response('events/registration-done.html', data, context_instance=RequestContext(request))
                
            else:
		
		data = {
                    'event': event,
                    'form': form,
		}
                
                return render_to_response('events/registration.html', data, context_instance=RequestContext(request))
                
        else:
            
            form=RegistrationForm(instance = event)
            
            data = {
                    'event': event,
                    'form': form,
            }
            
            return render_to_response('events/registration.html', data, context_instance=RequestContext(request))
Пример #2
0
def registration(request, id, slug):
    """Event registrations page."""
    event = get_object_or_404(Event, id=id, active=True)

    # If registration is closed, we should display a different page
    if event.registrationOpen is False:
        return render_to_response(
            "events/registration-closed.html", {'event': event})

    if request.method == "POST":
        form = RegistrationForm(request.POST, request.FILES)

        if form.is_valid():
            registration = form.save(commit=False)
            registration.event = event
            registration.status = "Invited"
            registration.hash = uuid.uuid1().hex
            registration.name = '%s %s' % (
                smart_str(registration.firstName),
                smart_str(registration.familyName))

            registration.save()

            # Email confirmation
            newMail(event.id, registration.id)

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

            return render_to_response(
                'events/registration-done.html',
                data,
                context_instance=RequestContext(request))

    else:
        form = RegistrationForm(instance=event)

    return render_to_response(
        'events/registration.html',
        {'event': event, 'form': form},
        context_instance=RequestContext(request))
Пример #3
0
         
 if request.method == "POST":
     
     form = RegistrationForm(request.POST, request.FILES)
     
     if form.is_valid():
         
         registration = form.save(commit=False)
         registration.event = event
         registration.confirmed = False
         registration.hash = uuid.uuid1().hex
         registration.name = smart_str(registration.firstName) + " " + smart_str(registration.familyName)
         registration.save()
         
         #Email confirmation
         newMail(event.id, registration.id)
 
 data = {
     'event': event,
     'form': form,
     'registration': registration,
         }
         
         return render_to_response('events/registration-done.html', data, context_instance=RequestContext(request))
         
     else:
 
 data = {
             'event': event,
             'form': form,
 }