Django, Haystack: show the time took by a search
I have a Django app that uses Haystack. Is it poss开发者_StackOverflow中文版ible to show after a search, in the search result page, how much time the search took ?
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.
精彩评论