Skip to content

Commit

Permalink
Merge pull request #1890 from Royal-Society-of-New-Zealand/issue-1889
Browse files Browse the repository at this point in the history
fix
  • Loading branch information
alanhamlett authored Oct 15, 2023
2 parents 0ede39d + bc73764 commit f8c7e2e
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions flask_admin/contrib/peewee/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def scaffold_pk(self):
def get_pk_value(self, model):
if self.model._meta.composite_key:
return tuple([
model._data[field_name]
getattr(model, field_name)
for field_name in self.model._meta.primary_key.field_names])
return getattr(model, self._primary_key)

Expand Down Expand Up @@ -218,8 +218,7 @@ def init_search(self):

# Check type
if not isinstance(p, (CharField, TextField)):
raise Exception('Can only search on text columns. ' +
'Failed to setup search for "%s"' % p)
raise Exception(f'Can only search on text columns. Failed to setup search for "{p}"')

self._search_fields.append(p)

Expand Down

0 comments on commit f8c7e2e

Please sign in to comment.