Beispiel #1
0
def students_edit(request, ref, id):
    me = getme(request)
    if not me or not me.owner or not (me.owner.mother or me.owner.father):
        return redirect('/register/redirect/')
    student = Students.fetch(id=id)
    if not student:
        return redirect('/{}/students/new/'.format(ref))
    forminit(request, 'student', student_fields, obj=student)
    context = {
        'new':
        False,
        'reg_year':
        getyear(),
        'family':
        me.owner,
        't_shirt_sizes':
        collect(
            Students.model.t_shirt_sizes, lambda obj: dict(
                collect(obj, lambda val, index: ['no' + str(index), val]))),
        'students':
        me.owner.children.all(),
        'ref':
        ref,
        'current_student':
        student,
        'e':
        request.session['e'],
        'p':
        request.session['p'],
    }
    return render(request, 'students2.html', context)
Beispiel #2
0
def changepassword(request, **kwargs):
    forminit(request, 'form', ['current_pw', 'password', 'pw_confm'])
    if request.method == 'GET':
        return changepassword_get(request, **kwargs)
    elif request.method == 'POST':
        return changepassword_post(request, **kwargs)
    else:
        return HttpResponse("Unrecognized HTTP Verb", status=405)
Beispiel #3
0
def login(request, **kwargs):
    # Do not put any user authorization here!
    forminit(request, 'login', ['username', 'password'])
    if request.method == 'GET':
        return login_get(request, **kwargs)
    elif request.method == 'POST':
        return login_post(request, **kwargs)
    else:
        print "Unrecognized HTTP Verb"
        return index(request, **kwargs)
Beispiel #4
0
def family(request, ref):
    forminit(request, 'family', ['last', 'phone', 'email'])
    forminit(request, 'user', ['username', 'password', 'pw_confm'])
    seshinit(request, 'password_set', False)
    if request.method == 'GET':
        return family_get(request, ref)
    elif request.method == 'POST':
        return family_post(request, ref)
    else:
        return HttpResponse("Unrecognized HTTP Verb", status=405)
Beispiel #5
0
def parents(request, ref):
    if restricted(request):
        return redirect('/')
    forminit(request, 'mom', [
        'mom_skipped', 'mom_first', 'mom_alt_last', 'mom_alt_phone',
        'mom_alt_email'
    ])
    forminit(request, 'dad', [
        'dad_skipped', 'dad_first', 'dad_alt_last', 'dad_alt_phone',
        'dad_alt_email'
    ])
    if request.method == 'GET':
        return parents_get(request, ref)
    elif request.method == 'POST':
        return parents_post(request, ref)
    else:
        print "Unrecognized HTTP Verb"
        return index(request, ref)