Example #1
0
def update_info(request):
    name = request.POST['name']
    phone = request.POST['phone']
    email = request.POST['email']
    student = get_student(request)
    profile = get_student_profile(student)
    if profile is None:
        profile = StudentProfile(user=student)
    profile.email = email
    profile.username = name
    profile.phone = phone
    profile.save()

    return redirect('dashboard')
Example #2
0
def add_student(request):
    if request.method == 'POST':
        student = Student()
        student.user_number = request.POST['number']
        student.password = request.POST['password']
        student.save()
        profile = StudentProfile()
        profile.user = student
        profile.username = request.POST['username']
        profile.email = request.POST['email']
        profile.phone = request.POST['phone']
        profile.save()
        return redirect('student_manage')
    else:
        return render_to_response('manage/new.html', RequestContext(request))