Exemplo n.º 1
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.views.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.views.members', kwargs={}))

    search_results = None
    if request.method == "POST":
        member_search_form = MemberSearchForm(request.POST)
        if member_search_form.is_valid():
            search_results = Member.objects.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))
Exemplo n.º 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":
			print "Yes!"
			# Send them over to the sign-in page.  This will trigger the Free Trial logic down the line.
			return HttpResponseRedirect(reverse('tablet.views.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.views.members', kwargs={}))
	return render_to_response('tablet/post_create.html',{'user':user}, context_instance=RequestContext(request))
Exemplo n.º 3
0
def signin_user_guest(request, username, guestof):
	user = get_object_or_404(User, username=username)
	member = get_object_or_404(Member, user=user)
	daily_log = DailyLog()
	daily_log.member = member
	daily_log.visit_date = date.today()
	if guestof:
		guestof_user = get_object_or_404(User, username=guestof)
		guestof_member = get_object_or_404(Member, user=guestof_user)
		daily_log.guest_of = guestof_member
	if DailyLog.objects.filter(member=member).count() == 0:
		daily_log.payment = 'Trial';
		email.announce_new_user(user)
	else:
		daily_log.payment = 'Bill';
		if not member.photo and member.is_active():
			email.announce_need_photo(user)
	daily_log.save()
		
	return HttpResponseRedirect(reverse('tablet.views.signin', kwargs={}))
Exemplo n.º 4
0
def signin_user_guest(request, username, guestof):
    user = get_object_or_404(User, username=username)
    member = get_object_or_404(Member, user=user)
    daily_log = DailyLog()
    daily_log.member = member
    daily_log.visit_date = timezone.localtime(timezone.now()).date()
    if guestof:
        guestof_user = get_object_or_404(User, username=guestof)
        guestof_member = get_object_or_404(Member, user=guestof_user)
        daily_log.guest_of = guestof_member
    if DailyLog.objects.filter(member=member).count() == 0:
        daily_log.payment = 'Trial'
        email.announce_new_user(user)
    else:
        daily_log.payment = 'Bill'
        if not member.photo and member.is_active():
            email.announce_need_photo(user)
    daily_log.save()

    return HttpResponseRedirect(
        reverse('tablet.views.welcome', kwargs={'username': username}))
Exemplo n.º 5
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.views.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.views.members', kwargs={}))

    search_results = None
    if request.method == "POST":
        member_search_form = MemberSearchForm(request.POST)
        if member_search_form.is_valid():
            search_results = Member.objects.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))
Exemplo n.º 6
0
Arquivo: views.py Projeto: xrmx/nadine
def signin_user_guest(request, username, guestof):
	user = get_object_or_404(User, username=username)
	member = get_object_or_404(Member, user=user)
	daily_log = DailyLog()
	daily_log.member = member
	daily_log.visit_date = timezone.localtime(timezone.now()).date()
	if guestof:
		guestof_user = get_object_or_404(User, username=guestof)
		guestof_member = get_object_or_404(Member, user=guestof_user)
		daily_log.guest_of = guestof_member
	if DailyLog.objects.filter(member=member).count() == 0:
		daily_log.payment = 'Trial';
	else:
		daily_log.payment = 'Bill';
	daily_log.save()
	
	if daily_log.payment == 'Trial':
		email.announce_new_user(user)
	else:
		if member.onboard_tasks_to_complete() > 0:
			email.announce_tasks_todo(user, member.onboard_tasks_incomplete())
	
	return HttpResponseRedirect(reverse('tablet.views.welcome', kwargs={'username':username}))