Hi Balu,
Numeric data from the form must be converted to int. I suspect you wanted to index data; not id_list. if request.method=="POST": data = request.POST temp_list = data.keys() id_list = [] for i in temp_list: id_list.append(id_list[i]) questions = MyModel.objects.filter(id__in = id_list) Should id_list.append(id_list[i]) Not be id_list.append(data[i]) -----Original Message----- From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On Behalf Of balu Sent: 18 February 2011 13:24 To: Django users Subject: list indices must be integers not unicode Hi all :) I'm processing a user submitted form. In that the user will answer a series of multiple choice questions. Depending on the question "id" which are submitted I'll find the compare the values and increment the score to count his marks. The question ids are keys from the dictionary request.POST. But it is showing an error the list indices must be integers not unicode. I wrote the code as follows. // In the view function if request.method=="POST": data = reques.POST temp_list = data.keys() id_list = [] for i in temp_list: id_list.append(id_list[i]) questions = MyModel.objects.filter(id__in = id_list) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.