2

I have a django view that prompts the user to enter something into an input. I want to measure the time that the user took to submit the form. How is this possible?

I've seen related problems like Printing Time spent on a view in Django but it doesn't seem to solve my issue, because I do not want to measure the time taken on a function call.

Alex

  • i think the would be a good fit for the middlewares https://docs.djangoproject.com/en/4.0/topics/http/middleware/#:~:text=Middleware%20is%20a%20framework%20of,for%20doing%20some%20specific%20function. – Brian Obot Mar 12 '22 at 13:32
  • Please provide enough code so others can better understand or reproduce the problem. – Community Mar 12 '22 at 14:20

1 Answers1

0

You can do this with pythons time package.

import time

# -user opens form-
start_time = time.time()
formExemple = input("Enter your age: ")
print("It took the user",  (time.time() - start_time), "secconds to submit the form.")
tuurtje11
  • 189
  • 1
  • 8