Measure Time spent on a view in django

Viewed 102

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

1 Answers

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.")
Related