Thanks for the reply!

On Dec 7, 8:41 pm, Michael Bayer <[email protected]> wrote:

> Well your EventOccurence has "event_name" already there as the primary key 
> so....order_by=event_name:
>
>     location = relationship(Location,
>        backref=backref(
>            "event_occurences",
>            cascade="all, delete-orphan",
>            order_by=event_name
>        ),
>     )
>
> If you needed to join out to Event in order to sort, things would be 
> trickier, but that's not the case here (deleted a crapload of text here 
> because I didn't notice at first).

But don't I? I'm trying to order by the date, which isn't there, it'd
need to be joined wouldn't it? Or have I misunderstood? (I've tried
what you said anyhow, but it seems to have sorted by name as I'd
expected, so, if that's what you meant I think I've misunderstood, I
can paste a more extensive example or try harder :).

> For the True/False you'd need the "events" association proxy probably to 
> refer to "successful".

A ha! This was the part I was missing. Thanks!

> you of course lose the ordering here as dictionaries aren't ordered.

I figured once I got to this point I can make my own MappedCollection
that uses OrderedDict instead.

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to