> Field('images', 'list:reference t_image'),
>
> I'd like to do the following:
>
> -make it so that the input for that field cannot be empty upon submission,
> and the number of references the user must select is in some range of
> numbers, (n_min, n_max)
>
The IS_IN_DB validator takes a "multiple" argument that can either be True
or a tuple with a min and max number of selections:
IS_IN_DB(..., multiple=(1,3))
-when a *select* element is created from that field (for example, through
> the use of SQLFORM), the *select* should only show references created by
> the user whose *id* matches session
> <http://127.0.0.1:8000/examples/global/vars/session>.auth.user.id; the
> *select* element should only show the last N references submitted by that
> user
>
The first argument to IS_IN_DB can be a DAL Set object that limits the set
of records. It also takes "groupby" and "orderby" arguments, though
unfortunately not a "limitby" argument (perhaps we should add that) -- so
that's makes it trickier to select the last N submissions. To get around
that problem, I suppose the Set object could include a query like
db.t_image.id.belongs(db([query])._select(...,
limitby=...)).
Anthony
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.