Exemplo n.º 1
0
def detail(request, username):
    user = get_object_or_404(User, username=username)
    emergency_contact = user.get_emergency_contact()
    memberships = Membership.objects.filter(user=user).order_by('start_date').reverse()
    email_logs = SentEmailLog.objects.filter(user=user).order_by('created').reverse()

    if request.method == 'POST':
        if 'send_manual_email' in request.POST:
            key = request.POST.get('message_key')
            email.send_manual(user, key)
        elif 'add_note' in request.POST:
            note = request.POST.get('note')
            MemberNote.objects.create(user=user, 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(user=user, month=month, day=day, year=year, description=desc)
        else:
            print(request.POST)

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

    context = {'user':user, 'emergency_contact': emergency_contact,
        'memberships': memberships, 'email_logs': email_logs,
        'email_keys': email_keys, 'settings': settings}
    return render(request, 'staff/member_detail.html', context)
Exemplo n.º 2
0
def detail(request, username):
    user = get_object_or_404(User, username=username)
    membership = Membership.objects.for_user(user)
    active_subscriptions = membership.subscriptions_for_day(
        target_date=localtime(now()).date())
    emergency_contact = user.get_emergency_contact()
    email_logs = SentEmailLog.objects.filter(
        user=user).order_by('created').reverse()
    member_notes = user.get_member_notes()
    payer = None
    payer_url = None
    for s in membership.active_subscriptions():
        if s.paid_by:
            payer = s.paid_by

    if request.method == 'POST':
        if 'send_manual_email' in request.POST:
            key = request.POST.get('message_key')
            email.send_manual(user, key)
        elif 'add_note' in request.POST:
            note = request.POST.get('note')
            print(note)
            MemberNote.objects.create(user=user,
                                      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(user=user,
                                      month=month,
                                      day=day,
                                      year=year,
                                      description=desc)
        else:
            print((request.POST))
    staff_members = User.objects.filter(is_staff=True).order_by('id').reverse()
    email_keys = email.valid_message_keys()
    email_keys.remove("all")

    context = {
        'user': user,
        'emergency_contact': emergency_contact,
        'active_subscriptions': active_subscriptions,
        'email_logs': email_logs,
        'email_keys': email_keys,
        'staff_members': staff_members,
        'settings': settings,
        'member_notes': member_notes,
        'payer': payer,
    }
    return render(request, 'staff/members/detail.html', context)
Exemplo n.º 3
0
def detail(request, username):
    user = get_object_or_404(User, username=username)
    membership = Membership.objects.for_user(user)
    active_subscriptions = membership.subscriptions_for_day(target_date=localtime(now()).date())
    emergency_contact = user.get_emergency_contact()
    email_logs = SentEmailLog.objects.filter(user=user).order_by('created').reverse()
    member_notes = user.get_member_notes()
    payer = None
    payer_url = None
    for s in membership.active_subscriptions():
        if s.paid_by:
            payer = s.paid_by

    if request.method == 'POST':
        if 'send_manual_email' in request.POST:
            key = request.POST.get('message_key')
            email.send_manual(user, key)
        elif 'add_note' in request.POST:
            note = request.POST.get('note')
            print(note)
            MemberNote.objects.create(user=user, 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(user=user, month=month, day=day, year=year, description=desc)
        else:
            print((request.POST))
    staff_members = User.objects.filter(is_staff=True).order_by('id').reverse()
    email_keys = email.valid_message_keys()
    email_keys.remove("all")

    context = {
        'user': user,
        'emergency_contact': emergency_contact,
        'active_subscriptions': active_subscriptions,
        'email_logs': email_logs,
        'email_keys': email_keys,
        'staff_members':staff_members,
        'settings': settings,
        'member_notes': member_notes,
        'payer': payer,
    }
    return render(request, 'staff/members/detail.html', context)
Exemplo n.º 4
0
def detail(request, username):
    user = get_object_or_404(User, username=username)
    emergency_contact = user.get_emergency_contact()
    memberships = Membership.objects.filter(
        user=user).order_by('start_date').reverse()
    email_logs = SentEmailLog.objects.filter(
        user=user).order_by('created').reverse()

    if request.method == 'POST':
        if 'send_manual_email' in request.POST:
            key = request.POST.get('message_key')
            email.send_manual(user, key)
        elif 'add_note' in request.POST:
            note = request.POST.get('note')
            MemberNote.objects.create(user=user,
                                      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(user=user,
                                      month=month,
                                      day=day,
                                      year=year,
                                      description=desc)
        else:
            print(request.POST)

    staff_members = User.objects.filter(is_staff=True).order_by('id').reverse()

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

    context = {
        'user': user,
        'emergency_contact': emergency_contact,
        'memberships': memberships,
        'email_logs': email_logs,
        'email_keys': email_keys,
        'settings': settings,
        'staff_members': staff_members,
    }
    return render(request, 'staff/user/detail.html', context)
Exemplo n.º 5
0
 def print_keys(self):
     print("Valid Message Keys: ")
     for key in email.valid_message_keys():
         print(("   " + key))