That would certainly be odd behavior, although I'm not exactly sure what you mean. Can you post the output that you're seeing and the view in question?
-James
def search(request):
p = []
cd = {}
qList=[]
request_context = RequestContext(request)
if request_context.request.GET:
form = SearchForm(request_context.request.GET)
# print form
if form.is_valid():
cd = request_context.request.GET
projectId = cd['project']
app = cd['app']
if cd['days'] != '0':
daysAgo = '-' + cd['days']
else:
daysAgo = cd['days']
sdtime = cd['sdtime']
edtime = cd['edtime']
qList = ["Hello, I am X", "Hello, I am Y", "Hello, I am A", "Hello, I am B"]
for func in qList:
print func
t.sleep(10)
p.append(func)
context = {'query_output': p, 'id_project': projectId,
'app': app, 'pOutput': p}
return render(request, 'temp.html', context)
else:
form = SearchForm()
return render_to_response('search_form.html', {'form': form})
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/04067a15-d2cd-48d9-810c-8abe5760278c%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/7be9a742-26dc-4a85-b6c1-2ab6def4696f%40googlegroups.com.
The code I shared is where the problem is. Here is the output once again from the server logs. It is evident that the second request is running into the first and appending the responses.The text in BOLD 'Entered Search' is the entry point for each request. I suspect a problem with looping qList or appending 'p'.Entered Search
<QueryDict: {u'project': [u'project1'], u'app': [u'app'], u'sdtime': [u'2016-05-30 00:00:00 UTC'], u'days': [u'0'], u'edtime': [u'2016-05-30 00:02:00 UTC']}>
Hello, I am X
Hello, I am Y
Hello, I am A
Entered Search
<QueryDict: {u'project': [u'project1'], u'app': [u'app'], u'sdtime': [u'2016-05-30 00:00:00 UTC'], u'days': [u'0'], u'edtime': [u'2016-05-30 00:02:00 UTC']}>
Hello, I am X
Hello, I am B
Hello, I am Y
[30/May/2016 22:00:35] "GET /search/?project=project1&app=app&days=0&sdtime=2016-05-30+00%3A00%3A00+UTC&edtime=2016-05-30+00%3A02%3A00+UTC HTTP/1.1" 200 893
Hello, I am A
Hello, I am B
[30/May/2016 22:00:58] "GET /search/?project=project1&app=app&days=0&sdtime=2016-05-30+00%3A00%3A00+UTC&edtime=2016-05-30+00%3A02%3A00+UTC HTTP/1.1" 200 1475
-James
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2851f295-6f8f-4ad3-b1d1-8768532b3fac%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9c5d164e-6f61-48a6-b8e6-7c0c36d0a02e%40googlegroups.com.