Пример #1
0
def registerstudent(request):
    username = request.POST['username']
    country = request.POST['country']
    password = request.POST['password']

    s = Student(username=username, password=password, country=country)
    s.save()

    if s.id:
        return HttpResponseRedirect(reverse('libraryindex'))
    else:
        return HttpResponse("Error in registeration")
Пример #2
0
def registeruser(request):
    data = request.POST

    username,password,gender,country = data['username'], data['password'],data['gender'],data['country']
    s = Student(username=username, password=password, gender=gender, country=country)
    s.save()

    if s.id:
        # successful insert inside the database table
        return HttpResponseRedirect(reverse('library:login-page'))
    else:
        return HttpResponse('Error in registration')
def register_user(request):
    username = request.POST['username']
    password = request.POST['password']
    country = request.POST['country']

    s = Student(username=username, password=password, country=country)
    s.save()

    if s.id:
        # successfully registered
        return HttpResponseRedirect(reverse('library:loginpage'))
    else:
        return HttpResponse('Error in registration')
def students(request):
    if request.method == "POST":
        sid = request.POST["sid"]
        firstname = request.POST["firstname"]
        lastname = request.POST["lastname"]
        department = request.POST["department"]
        section = request.POST["section"]
        year = request.POST["year"]

        student = Student(student_id=sid, firstname=firstname, lastname=lastname, department=department,
                          section=section, year=year)
        student.save()
        return redirect("/students")
    students = Student.objects.all()
    return render(request, "students.html", {"students": students})