def profiles_myprofile(request): from cms.forms import PresentationForm ps = request.user.presentation_set.all() context = {'data': ps} context = {'formSpeakerRegistration': PresentationForm(), 'ps': ps} return Render('profile.html', RequestContext(request, context))
def sponsor_list(request): from hashlib import md5 sponsors = Sponsor.objects.all() contributors = UserProfile.objects.filter(contributor=True) contributors = [{'name': c.user.get_full_name(), 'avatar': 'http://www.gravatar.com/avatar/%s'%md5(c.user.email).hexdigest(), 'twitter': c.twitter, 'what': c.what, 'pycon': c.pycon} for c in contributors] context = { 'platino': sponsors.filter(sponsorship_type='pl'), 'oro': sponsors.filter(sponsorship_type='g'), 'plata': sponsors.filter(sponsorship_type='p'), 'bronce': sponsors.filter(sponsorship_type='b'), 'organizador': sponsors.filter(sponsorship_type='o'), 'colaborador': contributors } return Render('sponsors.html', RequestContext(request, context))
def profile_password_reset(request, encoded): from profiles.forms import PasswordResetForm pr = get404(PasswordRecovery, encoded=encoded) if not pr.consumed: email, token = base64.b64decode(encoded).split('|') if email == pr.user.email and token == pr.token: if request.method == 'POST': form = PasswordResetForm(request.POST) if form.is_valid(): password = form.cleaned_data['new_password'] pr.user.set_password(password) pr.consumed = True pr.user.save() pr.delete() messages.success(request, 'Contraseña modificada satisfactoriamente') return HttpResponseRedirect('/') return HttpResponse(status=400, content=simplejson.dumps(form.errors)) context = {'form': PasswordResetForm()} return Render('password_reset.html', RequestContext(request, context)) mesasges.error(request, 'Token inválido o previamente consumido') return HttpResponseRedirect('/')