[web2py] Re: How to get the referenced objects from a list:reference

2011-08-22 Thread fishwebby
Yeh, that's what I've found myself doing. Now that I'm just assuming that the datastore is a list of objects identified by keys, I'm getting on much better with it (although like you say, some of my controller code is a little ugly but worth the price I think!) Cheers Dave On Aug 21, 11:56 pm,

[web2py] Re: How to get the referenced objects from a list:reference

2011-08-21 Thread fishwebby
. Anthony On Saturday, August 20, 2011 1:58:04 PM UTC-4, fishwebby wrote: Hi, I'm trying to do something quite straightforward but can't seem to work out how to do it: for a list:reference field, get all the items in the reference field (not just their IDs). For example, a person

[web2py] Re: Google datastore concepts - denormalising and list:reference fields

2011-08-21 Thread fishwebby
Ah ok, that makes sense. Is it really that easy to come up with a web request that takes more than thirty seconds? I'll have to watch out for that... I'm thinking now that I'm going about this the wrong way as regards the design for the datastore - from what I've read, contains is an efficient

[web2py] How to get the referenced objects from a list:reference

2011-08-20 Thread fishwebby
Hi, I'm trying to do something quite straightforward but can't seem to work out how to do it: for a list:reference field, get all the items in the reference field (not just their IDs). For example, a person with many courses: db.define_table('course', Field('title')) db.define_table('person',

[web2py] Re: Google datastore concepts - denormalising and list:reference fields

2011-08-19 Thread fishwebby
That's good to know, thanks - so for more than 30 items, something like this people = db(db.person.id.belongs(course.students)).select() isn't possible? Would it be possible for you to give me an example of using join tables? (I think my brain is still in SQL mode and I can't work out how I'd

[web2py] how to get number of rows returned by a query

2011-08-18 Thread fishwebby
Hi, I'm trying to get the number of rows returned by a query, so I can display No rows found in the view if none are returned, but I can't seem to find a way to do it - my query code is rows = db().select(db.course.id, db.course.title, orderby = db.course.title) Is there something like

[web2py] Re: how to get number of rows returned by a query

2011-08-18 Thread fishwebby
I knew there would be a simple answer - thank you!

[web2py] Re: how to get number of rows returned by a query

2011-08-18 Thread fishwebby
'}} {{pass}} An empty rows object evaluates to False. Anthony On Thursday, August 18, 2011 8:12:57 AM UTC-4, fishwebby wrote: I knew there would be a simple answer - thank you!

[web2py] Google datastore concepts - denormalising and list:reference fields

2011-08-17 Thread fishwebby
Hi, I'm currently learning web2py for deployment on Google App Engine, and I've got a couple of questions about how the datastore works. Let's say I've got a relational database with students, courses and enrolments. Enrolments is the join table that allows a many to many relationship between

[web2py] Re: Google datastore concepts - denormalising and list:reference fields

2011-08-17 Thread fishwebby
(posting Massimo's reply) e.g. 1, Physics 101, 4|5|6 Is that how data has to be modelled using the GAE datastore? No. On GAE 'list:reference' maps into a ListProperty of integers If so, is it possible to do the following: - paginate the denormalised data, for example show a paginated list

[web2py] Re: Google datastore concepts - denormalising and list:reference fields

2011-08-17 Thread fishwebby
a bit but the concepts are clearly explained by the presenter. Best wishes Dave On Aug 17, 1:40 pm, fishwebby pastelva...@gmail.com wrote: (posting Massimo's reply) e.g. 1, Physics 101, 4|5|6 Is that how data has to be modelled using the GAE datastore? No. On GAE 'list:reference' maps

[web2py] Re: Google datastore concepts - denormalising and list:reference fields

2011-08-17 Thread fishwebby
- paginate the denormalised data, for example show a paginated list of students on a course? You cannot. ListProperty does not allow this. How about something like this? limitby = (0, 10) students = db(db.student.id.belongs(course.students)).select(limitby = limitby) (where

[web2py] belongs and orderby not working on gae?

2011-08-17 Thread fishwebby
Hi, I've got the following query to select auth_users from a list of IDs, then ordered by name: users = db(db.auth_user.id.belongs((1,2,3))).select(orderby = db.auth_user.first_name) which works fine in sqlite, but when deployed to gae the orderby doesn't work. Do belongs and orderby not work

[web2py] Re: routes.py and rewriting URLs

2011-08-15 Thread fishwebby
) On Aug 14, 6:08 pm, Jonathan Lundell jlund...@pobox.com wrote: On Aug 14, 2011, at 3:26 AM, fishwebby wrote: I'm struggling with the routing in web2py and I'm hoping someone can point me in the right direction (I'm a web2py newbie). I want to change this (which works): http://127.0.0.1:8000

[web2py] Re: routes.py and rewriting URLs

2011-08-15 Thread fishwebby
, fishwebby pastelva...@gmail.com wrote: Hi, I'm struggling with the routing in web2py and I'm hoping someone can point me in the right direction (I'm a web2py newbie). I want to change this (which works): http://127.0.0.1:8000/init/admin_courses/index to this: http://127.0.0.1

[web2py] Scope authenticated users in accounts

2011-08-15 Thread fishwebby
(web2py newbie here) - I've got user authentication working ok, but I'd like to be able to scope the auth_users inside an account. My plan is to have accounts identified by subdomains, e.g. account_one.example.com, and then inside that the users can login (a la Basecamp). I've got the following

[web2py] Re: Scope authenticated users in accounts

2011-08-15 Thread fishwebby
could probably just use auth.requires (seehttp://web2py.com/book/default/chapter/08#Combining-Requirements). Anthony On Monday, August 15, 2011 4:31:33 PM UTC-4, fishwebby wrote: (web2py newbie here) - I've got user authentication working ok, but I'd like to be able to scope

[web2py] routes.py and rewriting URLs

2011-08-14 Thread fishwebby
Hi, I'm struggling with the routing in web2py and I'm hoping someone can point me in the right direction (I'm a web2py newbie). I want to change this (which works): http://127.0.0.1:8000/init/admin_courses/index to this: http://127.0.0.1:8000/admin/courses but I can't get it to work with the