Re: How to set attribute to the items in a QuerySet.

2009-12-16 Thread Xuqing Kuang
Good idea. Thank you very much :-) Xuqing On Dec 15, 7:19 pm, Daniel Roseman wrote: > On Dec 15, 7:02 am, Xuqing Kuang wrote: > > > > > Hi, all. > > > Are there any way could keep a attribute new set to a item in QuerySet > > object ? > > > For example: > > > >>> tcs = TestCase.objects.filter(

Re: How to set attribute to the items in a QuerySet.

2009-12-15 Thread Daniel Roseman
On Dec 15, 7:02 am, Xuqing Kuang wrote: > Hi, all. > > Are there any way could keep a attribute new set to a item in QuerySet > object ? > > For example: > > >>> tcs = TestCase.objects.filter(case_id__in = [1123, 1124, 1125]) > >>> tcs > > [, , MigrateOneWayDisk>]>>> tc = tcs[1] > >>> setattr(tc,

How to set attribute to the items in a QuerySet.

2009-12-14 Thread Xuqing Kuang
Hi, all. Are there any way could keep a attribute new set to a item in QuerySet object ? For example: >>> tcs = TestCase.objects.filter(case_id__in = [1123, 1124, 1125]) >>> tcs [, , ] >>> tc = tcs[1] >>> setattr(tc, 'selected_param', []) >>> tc.selected_param [] >>> tcs[1].selected_param Traceb