Пример #1
0
def student(request):
    if request.method == 'POST':
        fname = request.POST.get('fname')
        lname = request.POST.get('lname')
        cname = request.POST.get('cname')
        sname = request.POST.get('sname')
        mname = request.POST.get('mname')
        email = request.POST.get('email')
        telugu = request.POST.get('telugu')
        hindi = request.POST.get('hindi')
        english = request.POST.get('english')
        math = request.POST.get('math')

        data = Student(fname=fname,
                       lname=lname,
                       cname=cname,
                       sname=sname,
                       mobile=mname,
                       email=email,
                       telugu=telugu,
                       hindi=hindi,
                       english=english,
                       math=math)
        data.save()
        context = {'Studentdata': Student.objects.all()}
        return render(request, 'htmlfile/studentdata.html', context)

    context = {'Studentdata': Student.objects.all()}
    return render(request, 'htmlfile/studentdata.html', context)
Пример #2
0
def index(request):
    if (request.method == "POST"):
        name = request.POST.get('name')
        age = request.POST.get('age')
        Class = request.POST.get('Class')

        s = Student(name=name, age=age, Class=Class)
        s.save()
    return render(request, 'app1/index.html')
Пример #3
0
def funs(request):
    if request.method == "POST":
        data = request.POST
        if data.get("enquiry"):
            course_inst = Course.objects.get(pk=data.get("enq_course"))
            stdudent_inst = Student.objects.get(pk=data.get("enq_student"))
            enq = Enquiry(name=data.get("enq_name"),
                          student=stdudent_inst,
                          course=course_inst)
            enq.save()
        elif data.get("expense"):
            studyhall_inst = Studyhall.objects.get(
                pk=data.get("exp_studyhall"))
            exp = Expense(
                studyhall=studyhall_inst,
                date=data.get("exp_date"),
                name=data.get("exp_name"),
                desc=data.get("exp_desc"),
                value=data.get("exp_value"),
            )
            exp.save()

        elif data.get("student"):
            student = Student(
                name=data.get("stu_name"),
                address=data.get("stu_address"),
                phone=data.get("stu_phone"),
                email=data.get("stu_email"),
            )
            student.save()

        elif data.get("course"):
            course = Course(name=data.get("cour_name"), )
            course.save()

        else:
            hall = Studyhall(name=data.get("hall_name"),
                             area=data.get("hall_area"))
            hall.save()

    studyhalls = Studyhall.objects.all()
    expenses = Expense.objects.all()
    enquiries = Enquiry.objects.all()
    courses = Course.objects.all()
    students = Student.objects.all()
    return render(
        request, "app1/index.html", {
            "studyhalls": studyhalls,
            "expenses": expenses,
            "enquiries": enquiries,
            "students": students,
            "courses": courses,
        })
Пример #4
0
def save_registration(request):
     idno=request.POST.get("s1")
     name=request.POST.get("s2")
     contact=request.POST.get("s3")
     email=request.POST.get("s4")
     passw=request.POST.get("s5")
     Student(idno=idno,name=name,contact=contact,email=email,password=passw).save()
     messages.success(request," Registerd successfully")
     return redirect("student_index")
Пример #5
0
def save_info(request):
    name = request.POST.get("s1")
    contactno = request.POST.get("s2")
    email = request.POST.get("s3")
    password = request.POST.get("s4")
    print(password)
    Student(name=name, contactno=contactno, email=email,
            password=password).save()
    return redirect('main')