Skip to content

Commit

Permalink
Allow select options on has_many methods, updated bloggy example
Browse files Browse the repository at this point in the history
  • Loading branch information
gi0baro committed May 13, 2015
1 parent a4e51f0 commit be52246
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions examples/bloggy/bloggy.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ def _validate_comment(form):
post = db.Post(id=pid)
if not post:
abort(404)
# get comments and create a form
comments = db(db.Comment.post == post.id).select(orderby=~db.Comment.date)
# get comments and create a form for commenting
comments = post.comments(orderby=~db.Comment.date)
form = Comment.form(onvalidation=_validate_comment)
if form.accepted:
redirect(url('post', pid))
Expand Down
4 changes: 2 additions & 2 deletions weppy/dal.py
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ def __init__(self, ref, field):
self.ref = ref
self.field = field

def __call__(self, model, row):
def __call__(self, model, row, **kwargs):
rid = row[model.tablename].id
return model.db(model.db[self.ref][self.field] == rid).select()
return model.db(model.db[self.ref][self.field] == rid).select(**kwargs)


class computation(object):
Expand Down

0 comments on commit be52246

Please sign in to comment.