Read below

On Oct 27, 4:28 pm, "Mr.Freeze" <[EMAIL PROTECTED]> wrote:
> Hello web2py folks.  I am making a mileage tracker and ran into a
> small problem.  Here's part of my model:
>
> dbmileage.define_table('places',
>                         SQLField('name'),
>                         SQLField('bbuser_id', dbmileage.bbuser))
> dbmileage.define_table('distances',
>                         SQLField('origin', dbmileage.places),
>                         SQLField('destination', dbmileage.places),
>                         SQLField('distance','double'))
> dbmileage.define_table('trips',
>                         SQLField('origin', dbmileage.places),
>                         SQLField('destination', dbmileage.places),
>                         SQLField('date', 'date', default=now),
>                         SQLField('bbuser', dbmileage.bbuser))


db.trips.origin.requires=IS_IN_DB(db,'places.id','%(name)')
db.trips.destination.requires=IS_IN_DB(db(db.places.id!
=request.vars.origin),'places.id','%(name)',
error_message=T('destionation must be different form origin'))

This (!=) will not work on GAE

>
> The 'trips' table pulls both the 'origin' and 'destination' from the
> 'places' table.  What is the best way to ensure that a user selects
> different 'places' on an SQLFORM (i.e. don't allow trips with the same
> origin and destination)
>
> Thanks!
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to