Re: How to extract answer from QuerySet

2010-11-10 Thread Shawn Milochik
On Wed, Nov 10, 2010 at 5:16 PM, octopusgrabbus wrote: > Thank you. This worked well. > However, I'm left with this value > > > How do I get that into a comparable form? > It sounds like you're getting the __unicode__() representation of your model. If you want the data in the actual fields you'

Re: How to extract answer from QuerySet

2010-11-10 Thread octopusgrabbus
Thank you. This worked well. However, I'm left with this value How do I get that into a comparable form? On Nov 10, 4:06 pm, Łukasz Rekucki wrote: > On 10 November 2010 21:55, Shawn Milochik wrote: > > > The queryset returns zero or more instances of your model. So if > > there's only one resu

Re: How to extract answer from QuerySet

2010-11-10 Thread Shawn Milochik
Łukasz, Good and valid points. Thanks. Shawn -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegrou

Re: How to extract answer from QuerySet

2010-11-10 Thread Łukasz Rekucki
On 10 November 2010 22:10, Shawn Milochik wrote: > 2010/11/10 Łukasz Rekucki : >> On 10 November 2010 21:55, Shawn Milochik wrote: >>> The queryset returns zero or more instances of your model. So if >>> there's only one result, you can just get the first item in the >>> queryset by its index. >>

Re: How to extract answer from QuerySet

2010-11-10 Thread Shawn Milochik
2010/11/10 Łukasz Rekucki : > On 10 November 2010 21:55, Shawn Milochik wrote: >> The queryset returns zero or more instances of your model. So if >> there's only one result, you can just get the first item in the >> queryset by its index. >> >> For example: >> >> some_queryset = YourModel.objects

Re: How to extract answer from QuerySet

2010-11-10 Thread Łukasz Rekucki
On 10 November 2010 21:55, Shawn Milochik wrote: > The queryset returns zero or more instances of your model. So if > there's only one result, you can just get the first item in the > queryset by its index. > > For example: > > some_queryset = YourModel.objects.filter(**kwargs) > > if some_queryse

Re: How to extract answer from QuerySet

2010-11-10 Thread Shawn Milochik
The queryset returns zero or more instances of your model. So if there's only one result, you can just get the first item in the queryset by its index. For example: some_queryset = YourModel.objects.filter(**kwargs) if some_queryset.count() == 1: x = some_queryset[0] #x is now an instanc

Re: How to extract answer from QuerySet

2010-11-10 Thread octopusgrabbus
This may not be the best way, but it works: temp_ept_id = EptInv.objects.filter(inv_id=80581770).values_list() and I got it from http://docs.djangoproject.com/en/1.0/ref/models/querysets/ On Nov 10, 3:47 pm, octopusgrabbus wrote: > My new model class works great. It returns my answer, but in

How to extract answer from QuerySet

2010-11-10 Thread octopusgrabbus
My new model class works great. It returns my answer, but in a query set, and the table is set up only to return one element in the QuerySet due to the indexes. My problem is how to extract the data from that QuerySet. repr() does not work, because the model class has no repr method. How do I extr