Re: Four Hop, Two Criteria Query
Just be careful with the index errors. If you are sure that this query will allway have at least one item, so this is fine. But if it returns an empty queryset, so you will have trouble with IndexError.
Atenciosamente,
Vinicius Mendes
Solucione Sistemas
vinicius@solucione.info
On Thu, May 27, 2010 at 10:11 PM, Lee Hinde <leehinde@gmail.com> wrote:
On Thu, May 27, 2010 at 5:44 PM, Lee Hinde <leehinde@gmail.com> wrote:weather = Weather.objects.filter(weather_date=self.target_date,zip_code=self.created_by.store.zip_code)so, the solution wasdef get_weather(self):weather = Weather.objects.filter(weather_date=self.target_date,zip_code=self.created_by.store.zip_code)[0]return weatherjust return a single record....--
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+unsubscribe@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home