CCI-MOC / flocx-market

2 stars 9 forks source link

We should be using .one (or .one_or_none) instead of .first in the database api #111

Closed larsks closed 5 years ago

larsks commented 5 years ago

Many of our database api get operations using the .first() filter on queries, but this inappropriate: if the query returns more than a single result, something is wrong.

ljmcgann commented 5 years ago

So we do not want to raise errors in get?

larsks commented 5 years ago

I don't know! We aren't currently; we're just returning None if there are no matches.

tzumainn commented 5 years ago

I think we want to raise errors; but after this code merges, we'll just see if a get returns None, and if so, throw an exception.