Ejemplo n.º 1
0
def viewCourseDetails(request, coursename):  # 显示课程的详细信息
    sessionManager = SessionManager(request)
    if sessionManager.isAdministrator():  #如果是管理员登陆
        courses = Course.objects.get(
            coursename=coursename)  # 查询当前课程信息,为了后面显示详细信息
        detailcourse = BuyRecord.objects.filter(
            coursename=coursename)  # 查询这个课程的所有订单(包括付钱和没付钱的)
        Authority = 'Admin'

    else:  #如果是客户或教练登录
        username = sessionManager.getUsername()  # 获取当前登录的用户名字
        courses = Course.objects.get(
            coursename=coursename)  # 查询当前课程信息,为了后面显示详细信息
        if sessionManager.isTrainer():  #如果是教练
            Authority = 'Trainer'

        else:
            Authority = 'Customer'
        detailcourse = BuyRecord.objects.filter(username=username,
                                                coursename=coursename)
    # 查询这个用户关于这门课的订单状态(付钱和没付钱的)
    return render(request, 'detailmessageUI.html', {
        'Authority': Authority,
        'courses': courses,
        'order1': detailcourse
    })
Ejemplo n.º 2
0
def completeInformation(request):
    sessionManager = SessionManager(request)
    if sessionManager.isAdministrator():  # 如果是管理员登录
        Authority = 'Admin'
    else:
        if sessionManager.isTrainer():  #教练登录
            Authority = 'Trainer'
        else:  # 如果是客户登陆
            Authority = 'Customer'
    # if sessionManager.isLogouted():
    #     return HttpResponseRedirect(url_login)
    if request.method == 'POST':
        completeForm = CompleteForm(request.POST)
        if completeForm.is_valid():
            identity = request.POST.get('identity')
            name = completeForm.cleaned_data.get('name')
            age = completeForm.cleaned_data.get('age')
            profession = completeForm.cleaned_data.get('profession')
            phoneNumber = completeForm.cleaned_data.get('phoneNumber')
            sex = completeForm.cleaned_data.get('sex')
            birthday = completeForm.cleaned_data.get('birthday')
            height = completeForm.cleaned_data.get('height')
            weight = completeForm.cleaned_data.get('weight')
            bust = completeForm.cleaned_data.get('bust')
            waistline = completeForm.cleaned_data.get('waistline')
            hipline = completeForm.cleaned_data.get('hipline')
            shoulderwidth = completeForm.cleaned_data.get('shoulderwidth')

            username = sessionManager.getUsername()
            personalInformation = PersonalInformation.objects.get(
                username=username)
            personalInformation.setIdentity(identity)
            personalInformation.setName(name)
            personalInformation.setAge(age)
            personalInformation.setProfession(profession)
            personalInformation.setPhoneNumber(phoneNumber)
            personalInformation.setSex(sex)
            personalInformation.setBirthday(birthday)
            personalInformation.setHeight(height)
            personalInformation.setWeight(weight)
            personalInformation.setBust(bust)
            personalInformation.setWaistline(waistline)
            personalInformation.setHipline(hipline)
            personalInformation.setShoulderwidth(shoulderwidth)

            return HttpResponseRedirect(url_index_logined)
    else:
        username = sessionManager.getUsername()
        user = PersonalInformation.objects.get(username=username)
        completeForm = CompleteForm(instance=user)
    return render(request, 'completeinformation.html', {
        'completeForm': completeForm,
        'Authority': Authority
    })  # 渲染页面
Ejemplo n.º 3
0
def vipDetails(request, username):
    sessionManager = SessionManager(request)
    if sessionManager.isAdministrator():  # 如果是管理员登陆
        Authority = 'Admin'
    elif sessionManager.isTrainer():
        Authority = 'Trainer'
    else:  # 如果是客户登陆
        Authority = 'Customer'
    userList = PersonalInformation.objects.filter(username=username)
    detailflag = 'true'
    return render(request, 'vipInformations.html', {
        "user_list": userList,
        'Authority': Authority,
        'detailflag': detailflag
    })
Ejemplo n.º 4
0
def viewCourse(request):  # 查看课程信息
    sessionManager = SessionManager(request)
    if sessionManager.isAdministrator():
        courses = Course.objects.all()  # 查询全部课程信息
        Authority = 'Admin'

    elif sessionManager.isTrainer():
        Authority = 'Trainer'
    else:  #如果是用户或教练登陆
        Authority = 'Customer'
    courses = Course.objects.filter(course_flag=True)  # 查询在使用的课程信息
    return render(request, 'coursemessageUI.html', {
        'order': courses,
        'Authority': Authority
    })
Ejemplo n.º 5
0
def vipInformation(request):
    sessionManager = SessionManager(request)
    if sessionManager.isAdministrator():  # 如果是管理员登录
        Authority = 'Admin'
    else:
        if sessionManager.isTrainer():  #教练登录
            Authority = 'Trainer'
        else:  # 如果是客户登录
            Authority = 'Customer'
    userList = PersonalInformation.objects.all()
    detailflag = 'false'
    return render(request, 'vipInformations.html', {
        'user_list': userList,
        'Authority': Authority,
        'detailflag': detailflag
    })  # 渲染页面
Ejemplo n.º 6
0
def viewMemeberList(request):
    sessionManager = SessionManager(request)
    if sessionManager.isAdministrator():  # 如果是管理员登录
        Authority = 'Admin'
    elif sessionManager.isTrainer():
        Authority = 'Trainer'
    else:  # 如果是客户登录
        Authority = 'Customer'
    # if sessionManager.isLogouted():
    #     return HttpResponseRedirect(url_login)
    # if not sessionManager.isAdministrator():
    #     return HttpResponseRedirect(url_index)
    userList = PersonalInformation.objects.all()
    detailflag = 'false'
    return render(request, 'vipInformations.html', {
        'user_list': userList,
        'Authority': Authority,
        'detailflag': detailflag
    })