def registration_preview(request): #def pay_membership_preview(request, username): username = request.user.username f = ConferenceRegistrationForm(request.POST, request.FILES) f.user = request.user if f.is_valid(): if f.cleaned_data.get('resume', None): resume = Attachment() resume.creator = request.user resume.content_type = ContentType.objects.get_for_model(request.user) resume.object_id = request.user.id resume.attachment_file = f.cleaned_data['resume'] resume.save() return ConferenceRegistrationFormPreview(ConferenceRegistrationForm)(request, username=username)
def registration_preview(request): #def pay_membership_preview(request, username): username = request.user.username f = ConferenceRegistrationForm(request.POST, request.FILES) f.user = request.user if f.is_valid(): if f.cleaned_data.get('resume', None): resume = Attachment() resume.creator = request.user resume.content_type = ContentType.objects.get_for_model( request.user) resume.object_id = request.user.id resume.attachment_file = f.cleaned_data['resume'] resume.save() return ConferenceRegistrationFormPreview(ConferenceRegistrationForm)( request, username=username)
def view_registration(request): if not request.user.is_authenticated(): return HttpResponseRedirect(reverse('conference_login')) user = request.user try: # if already registered, we display "thank you" page and offer # cancellation or a receipt registration = ConferenceRegistration.objects.get(user=user, cancelled=False) form = None return HttpResponseRedirect(reverse('confcomm_app')) except ObjectDoesNotExist: # if not registered, we display the registration form registration = None if request.method == 'POST': # or, in this case, process the registration form... form = ConferenceRegistrationForm(request.POST) form.user = user if form.is_valid(): registration = form.save() else: form = ConferenceRegistrationForm() form.user = user needsRenewal = needsToRenew(request.user.get_profile()) return render_to_response('conference/registration.html', { 'registration': registration, 'form': form, 'user': request.user, 'needsRenewal': needsRenewal }, context_instance=RequestContext(request))
def view_registration(request): if not request.user.is_authenticated(): return HttpResponseRedirect(reverse('conference_login')) user = request.user try: # if already registered, we display "thank you" page and offer # cancellation or a receipt registration = ConferenceRegistration.objects.get(user=user, cancelled=False) form = None return HttpResponseRedirect(reverse('confcomm_app')) except ObjectDoesNotExist: # if not registered, we display the registration form registration = None if request.method == 'POST': # or, in this case, process the registration form... form = ConferenceRegistrationForm(request.POST) form.user = user if form.is_valid(): registration = form.save() else: form = ConferenceRegistrationForm() form.user = user needsRenewal = needsToRenew(request.user.get_profile()) return render_to_response('conference/registration.html', {'registration': registration, 'form': form, 'user': request.user, 'needsRenewal': needsRenewal }, context_instance=RequestContext(request) )