Django, Haystack: show the time took by a search
-
09-10-2019 - |
Question
I have a Django app that uses Haystack. Is it possible to show after a search, in the search result page, how much time the search took ?
Solution
You can use the time
module from python to achieve that:
import time
start = time.time()
# code which performs search
end = time.time()
time_taken = end - start
Push time_taken
to your template.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow