>
> I second the weirdness.  I'd try tossing an
>
>   assert False, len(future_events)
>
> immediately after the
>
>   future_events = Event.objects.select_related().filter(...)
>
> statement to see what Django thinks it's bringing back for future
> events.
>
> > It wasn't anything to do with region, which isn't another table, it's
> > just a field under Club with choices (since they'll basically never
> > change)
>
> ah...helpful to know.  So from what I've discerned from your
> models, you have something like
>
> class Club(Model):
>   REGIONS = (
>     ('NE', 'NorthEast'),
>     ('PAC', 'Pacific'),
>     #...
>     )
>   region = CharField(..., choices=Club.REGIONS)
>   name = CharField(...)
>
> class Event(Model):
>   club = ForeignKey(Club) # FK or M2M?
>   start_date = DateField(...)
>
> Anything important I'm missing here?
>
> I'm not sure why it's not behaving properly with the
> select_related, as that should allow you to pull back the whole
> bunch in one query (as opposed to performing a query for each event).
>
> -tim

Yup, that's more or less it. event.club is a FK.

Definitely odd, but when I put the select related in, it only finds 4
future events instead of the 13. WIthout it, I'm fine. I can't figure
out where or why it decided to quit at 4, but I'm not sure in this
case it really matters. Since region isn't another table, I'm not sure
what I'd gain by select_related (which admittedly, I don't completely
understand).
But hey, it's working, and it's MILES better than what I had. Thanks
for all your help!


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to