I have a function in views.py
def get_interview_type(request):
i = None
title = request.GET['title'] #Here the title becomes different
try:
i = Interview.objects.get(title=title) #it looks for that
dropdown value
#Error according to pdb
#-> i = Interview.objects.get(title=title)
# (Pdb)
# DoesNotExist: DoesNotE...exist.',)
if i.interview_type == "Time Series":
visit_ids = i.visit_set.all()
reference_visit_list = []
for visit in visit_ids:
reference_visit_list.append(visit.reference_visit)
reference_visit_list.extend(visit_ids)
list(set(reference_visit_list))
len_visits=filter(None,reference_visit_list)
total_visits = len(len_visits)
return render_to_response('export/get_details.html',
{'visits':visit_ids,'count':visit_ids.count(),
'total_visits':total_visits},
context_instance=RequestContext(request)
)
else:
return
render_to_response('export/get_interview_type.html',
{'visits':i.visit_set.all()},
context_instance=RequestContext(request)
)
except Interview.DoesNotExist:
pass
When the user selects a title from the dropdown this function is called and
does it tasks.
Now i have entered a string which include '&' ampersand thinking that it
can play a role of 'and' in normal english like this :-
'CI-2-UGI & Bowel Symptom Screening & Characterization'(It is one of that
dropdown value)
Now when user selects this value from dropdown the title does not remain
the same, instead the title changes to CI-2-UGI(in title =
request.GET['title']) and before the function executes i recieve a 500
error page.
This is what the error prints in runserver mode
>
/home/user/cpms/careprep/tags/4.0/careprep/export/views.py(66)get_interview_type()->None
-> pass
(Pdb) c
[11/Mar/2012 22:05:20] "GET
/export/get_interview_type/?title=CI-2-UGI%20&%20Bowel%20Symptom%20Screening%20&%20Characterization
HTTP/1.1" 500 64490
Also when i remove that '&'ampersand from the title there is no 500 page.
Now & is breaks the quesrystring what i know then how to solve the problem.
I try having a look to url -encode but no luck .
I want whatever the drop value contains (&,@ ....etc) it should not break ?
How to solve the problem ?
Thanks in advance
--
Regards
Nikhil Verma
+91-958-273-3156
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.