def notify(request): template = loader.get_template('notify.html') context = RequestContext(request, { '': '', }) if request.method == "POST": if request.POST[u'email']: if SignUp.objects.filter(email=request.POST[u'email']).exists(): messages.success(request, 'Thank you AGAIN, ' + request.POST[u'email'] + '!') return HttpResponseRedirect('/notify') else: new_signup = SignUp(email=request.POST[u'email']) new_signup.save() messages.success(request, 'Thank you, ' + request.POST[u'email'] + '!') return HttpResponseRedirect('/notify') return HttpResponse(template.render(context))
def home(request): template = loader.get_template('index-new.html') context = RequestContext(request, { 'templates': Template.objects(user=None).order_by('-id')[:7] }) if request.method == "POST": if request.POST[u'email']: if SignUp.objects.filter(email=request.POST[u'email']).exists(): messages.success(request, 'Thank you AGAIN, ' + request.POST[u'email'] + '!') return HttpResponseRedirect('/') else: new_signup = SignUp(email=request.POST[u'email']) new_signup.save() messages.success(request, 'Thank you, ' + request.POST[u'email'] + '!') return HttpResponseRedirect('/') return HttpResponse(template.render(context))