I have the folowing classes:
#####
class Dog(SQLObject):
    name           = StringCol(length   = 25,
                               notNone  = True)
    description    = StringCol(notNone  = True)
    sex            = EnumCol(enumValues = ['reu','teef','onbekend'],
                             default    = "onbekend")
    isNeutered     = BoolCol(default    = "False")
    mayOnMeadow    = BoolCol(default    = "False")
    needSupervisor = BoolCol(default    = "False")
    mayHike        = BoolCol(default    = "False")
    morningFood    = StringCol()
    afternoonFood  = StringCol()
    eveningFood    = StringCol()
    notes          = StringCol()
    owner          = ForeignKey("Owner")
    playsWith      = RelatedJoin("Dog", joinColumn = "dog_id",
otherColumn = "friend_id")
    reservation    = MultipleJoin("Reservation", joinColumn = 'dog_id')

    def __str__(self):
        dog = self.name
        if self.owner:
            owner = self.owner
            dog   = '%s van %s %s uit %s' % (dog,
                                             owner.firstName,
                                             owner.lastName,
                                             owner.place)
        elif self.description:
            dog = '%s: %s' % (dog, self.description)
        return dog

class Reservation(SQLObject):
    dog = ForeignKey("Dog")
    startDate = DateCol()
    endDate = DateCol()
    hutch = ForeignKey("Hutch")
    morningFood = StringCol()
    afternoonFood = StringCol()
    eveningFood = StringCol()
    notesDog = StringCol()
    notesGeneral = StringCol()
#####

I would like to select all those reservations from a certain date
where the value of mayOnMeadow of the dog is True.
Something like (this does not work):
#####
        reservations = Reservation.select(AND(Reservation.q.startDate
<= thisDay,
                                              Reservation.q.endDate
>= thisDay,
                                              Reservation.q.dog.mayOnMeadow),
                                          orderBy =
Reservation.q.hutch).reversed()
#####

Is this possible? If so, how?
Or do I just do a select and filter the values in a for loop?

-- 
Cecil Westerhof

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

Reply via email to