Exemple #1
0
def post_create(request, username):
    user = get_object_or_404(User, username=username)
    if "work_today" in request.POST:
        work_today = request.POST.get('work_today')
        if work_today == "Yes":
            # Send them over to the sign-in page.  This will trigger the Free Trial logic down the line.
            return HttpResponseRedirect(
                reverse('tablet:signin_user',
                        kwargs={'username': user.username}))
        else:
            try:
                email.announce_new_user(user)
            except:
                logger.error("Could not send introduction email to %s" %
                             user.email)
            return HttpResponseRedirect(reverse('tablet:members', kwargs={}))

    search_results = None
    if request.method == "POST":
        member_search_form = MemberSearchForm(request.POST)
        if member_search_form.is_valid():
            search_results = User.helper.search(
                member_search_form.cleaned_data['terms'], active_only=True)

    return render(request, 'tablet/post_create.html', {
        'user': user,
        'search_results': search_results
    })
Exemple #2
0
def post_create(request, username):
    user = get_object_or_404(User, username=username)
    if request.POST.has_key("work_today"):
        work_today = request.POST.get('work_today')
        if work_today == "Yes":
            # Send them over to the sign-in page.  This will trigger the Free Trial logic down the line.
            return HttpResponseRedirect(reverse('tablet_signin_user', kwargs={'username': user.username}))
        else:
            try:
                email.announce_new_user(user)
            except:
                logger.error("Could not send introduction email to %s" % user.email)
            return HttpResponseRedirect(reverse('tablet_members', kwargs={}))

    search_results = None
    if request.method == "POST":
        member_search_form = MemberSearchForm(request.POST)
        if member_search_form.is_valid():
            search_results = User.helper.search(member_search_form.cleaned_data['terms'], active_only=True)

    return render_to_response('tablet/post_create.html', {'user': user, 'search_results': search_results}, context_instance=RequestContext(request))