Ejemplo n.º 1
0
def member_detail(request, member_id):
    member = get_object_or_404(Member, pk=member_id)
    #daily_logs = DailyLog.objects.filter(member=member).order_by('visit_date').reverse()
    memberships = Membership.objects.filter(member=member).order_by('start_date').reverse()
    email_logs = SentEmailLog.objects.filter(member=member).order_by('created').reverse()

    if request.method == 'POST':
        if 'send_manual_email' in request.POST:
            key = request.POST.get('message_key')
            email.send_manual(member.user, key)
        elif 'add_note' in request.POST:
            note = request.POST.get('note')
            MemberNote.objects.create(member=member, created_by=request.user, note=note)
        elif 'add_special_day' in request.POST:
            month = request.POST.get('month')
            day = request.POST.get('day')
            year = request.POST.get('year')
            if len(year) == 0:
                year = None
            desc = request.POST.get('description')
            SpecialDay.objects.create(member=member, month=month, day=day, year=year, description=desc)
        else:
            print request.POST

    email_keys = email.valid_message_keys()
    email_keys.remove("all")

    return render_to_response('staff/member_detail.html', {'member': member, 'memberships': memberships, 'email_logs': email_logs, 'email_keys': email_keys, 'settings': settings}, context_instance=RequestContext(request))
Ejemplo n.º 2
0
def detail(request, member_id):
    member = get_object_or_404(Member, pk=member_id)
    #daily_logs = DailyLog.objects.filter(member=member).order_by('visit_date').reverse()
    emergency_contact = member.user.get_emergency_contact()
    memberships = Membership.objects.filter(
        member=member).order_by('start_date').reverse()
    email_logs = SentEmailLog.objects.filter(
        member=member).order_by('created').reverse()

    if request.method == 'POST':
        if 'send_manual_email' in request.POST:
            key = request.POST.get('message_key')
            email.send_manual(member.user, key)
        elif 'add_note' in request.POST:
            note = request.POST.get('note')
            MemberNote.objects.create(member=member,
                                      created_by=request.user,
                                      note=note)
        elif 'add_special_day' in request.POST:
            month = request.POST.get('month')
            day = request.POST.get('day')
            year = request.POST.get('year')
            if len(year) == 0:
                year = None
            desc = request.POST.get('description')
            SpecialDay.objects.create(member=member,
                                      month=month,
                                      day=day,
                                      year=year,
                                      description=desc)
        else:
            print(request.POST)

    email_keys = email.valid_message_keys()
    email_keys.remove("all")

    return render_to_response('staff/member_detail.html', {
        'member': member,
        'emergency_contact': emergency_contact,
        'memberships': memberships,
        'email_logs': email_logs,
        'email_keys': email_keys,
        'settings': settings
    },
                              context_instance=RequestContext(request))
Ejemplo n.º 3
0
 def print_keys(self):
     print("Valid Message Keys: ")
     for key in email.valid_message_keys():
         print "   " + key
Ejemplo n.º 4
0
 def print_keys(self):
     print("Valid Message Keys: ")
     for key in email.valid_message_keys():
         print "   " + key