Login

Tag "search"

Snippet List

Updated version of #31

This is, I think, a slightly cleaner implentation of what [snippet 31](/snippets/31/) is trying to do; by starting off with a dictionary containing the things we want to look for, and using a list comprehension to kill anything which comes out of the form as `None`, we can avoid some of the intermediate data structures the other snippet was using, and hopefully get better performance. This is also quite a bit more maintainable, because supporting additional options now only requires adding a new key/value pair to `qdict`.

  • search
  • q-objects
Read More

Search in a model spanning relations

By popular demand an example of search in models that spans more realtions. Keep a list of Q, filter the None away, feed the rest to .filter() Credit goes to Carlo C8E Miron for the idea... cheers buddy! ;)

  • search
Read More

17 snippets posted so far.