remove some raw sql statements in favour of django ORM - this way we should avoid some potential problems with memory usage and sql IN clause limits for a LFS instances with a big number of products