On Mon, Nov 21, 2011 at 12:41 PM, thodoris <[email protected]> wrote:
> Two questions:
>
> and i want the videos.table field to take values only from the entries
> that the same user has entered or Null
>
> NoneType' object has no attribute 'id' , because the user initially is
> not logged in so there is no auth.user.id
>
> How can i solve this?

if auth.user:
  db.videos.table.requires =
  IS_IN_DB(db(db.table.author_id==auth.user.id), db.table.id, '%
  (title)s')
else:
  db.videos.table.requires =
  IS_IN_DB(db(db.table.author_id==None), db.table.id, '%
  (title)s')

But, according to your define_table()'s, these tables can only be
managed (insert or update) with a logged user, or default contents
will raise an excpetion because there's no logged user.

--
Vinicius Assef.

Reply via email to