Skip to content

Commit

Permalink
DbFormPage - only filter by primary key columns
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown authored and unknown committed Jul 18, 2012
1 parent af8eaa8 commit df3090e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tw2/sqla/widgets.py
Expand Up @@ -263,9 +263,9 @@ class DbFormPage(DbPage, twf.FormPage):
_no_autoid = True

def fetch_data(self, req):
filter = dict([
(key.__str__(), value) for key, value in req.GET.mixed().items()
])
data = req.GET.mixed()
filter = dict((col.name, data.get(col.name))
for col in sa.orm.class_mapper(self.entity).primary_key)
self.value = req.GET and self.entity.query.filter_by(**filter).first() or None

@classmethod
Expand Down

0 comments on commit df3090e

Please sign in to comment.