| 52 | | ========== ============================================================== |
|---|
| 53 | | Type Description |
|---|
| 54 | | ========== ============================================================== |
|---|
| 55 | | exact Exact match: ``polls.get_object(id__exact=14)``. |
|---|
| 56 | | iexact Case-insensitive exact match: |
|---|
| 57 | | ``polls.get_list(slug__iexact="foo")`` matches a slug of ``foo``, |
|---|
| 58 | | ``FOO``, ``fOo``, etc. |
|---|
| 59 | | contains Case-sensitive containment test: |
|---|
| 60 | | ``polls.get_list(question__contains="spam")`` returns all polls |
|---|
| 61 | | that contain "spam" in the question. (PostgreSQL only. MySQL |
|---|
| 62 | | doesn't support case-sensitive LIKE statements; ``contains`` |
|---|
| 63 | | will act like ``icontains`` for MySQL.) |
|---|
| 64 | | icontains Case-insensitive containment test. |
|---|
| 65 | | gt Greater than: ``polls.get_list(id__gt=4)``. |
|---|
| 66 | | gte Greater than or equal to. |
|---|
| 67 | | lt Less than. |
|---|
| 68 | | lte Less than or equal to. |
|---|
| 69 | | startswith Case-sensitive starts-with: |
|---|
| 70 | | ``polls.get_list(question_startswith="Would")``. (PostgreSQL |
|---|
| 71 | | only. MySQL doesn't support case-sensitive LIKE statements; |
|---|
| 72 | | ``startswith`` will act like ``istartswith`` for MySQL.) |
|---|
| 73 | | endswith Case-sensitive ends-with. (PostgreSQL only. MySQL doesn't |
|---|
| 74 | | support case-sensitive LIKE statements; ``endswith`` will act |
|---|
| 75 | | like ``iendswith`` for MySQL.) |
|---|
| 76 | | istartswith Case-insensitive starts-with. |
|---|
| 77 | | iendswith Case-insensitive ends-with. |
|---|
| 78 | | range Range test: |
|---|
| 79 | | ``polls.get_list(pub_date__range=(start_date, end_date))`` |
|---|
| 80 | | returns all polls with a pub_date between ``start_date`` |
|---|
| 81 | | and ``end_date`` (inclusive). |
|---|
| 82 | | year For date/datetime fields, exact year match: |
|---|
| 83 | | ``polls.get_count(pub_date__year=2005)``. |
|---|
| 84 | | month For date/datetime fields, exact month match. |
|---|
| 85 | | day For date/datetime fields, exact day match. |
|---|
| 86 | | isnull True/False; does is IF NULL/IF NOT NULL lookup: |
|---|
| 87 | | ``polls.get_list(expire_date__isnull=True)``. |
|---|
| 88 | | ========== ============================================================== |
|---|
| | 52 | =========== ============================================================== |
|---|
| | 53 | Type Description |
|---|
| | 54 | =========== ============================================================== |
|---|
| | 55 | exact Exact match: ``polls.get_object(id__exact=14)``. |
|---|
| | 56 | iexact Case-insensitive exact match: |
|---|
| | 57 | ``polls.get_list(slug__iexact="foo")`` matches a slug of |
|---|
| | 58 | ``foo``, ``FOO``, ``fOo``, etc. |
|---|
| | 59 | contains Case-sensitive containment test: |
|---|
| | 60 | ``polls.get_list(question__contains="spam")`` returns all polls |
|---|
| | 61 | that contain "spam" in the question. (PostgreSQL only. MySQL |
|---|
| | 62 | doesn't support case-sensitive LIKE statements; ``contains`` |
|---|
| | 63 | will act like ``icontains`` for MySQL.) |
|---|
| | 64 | icontains Case-insensitive containment test. |
|---|
| | 65 | gt Greater than: ``polls.get_list(id__gt=4)``. |
|---|
| | 66 | gte Greater than or equal to. |
|---|
| | 67 | lt Less than. |
|---|
| | 68 | lte Less than or equal to. |
|---|
| | 69 | startswith Case-sensitive starts-with: |
|---|
| | 70 | ``polls.get_list(question_startswith="Would")``. (PostgreSQL |
|---|
| | 71 | only. MySQL doesn't support case-sensitive LIKE statements; |
|---|
| | 72 | ``startswith`` will act like ``istartswith`` for MySQL.) |
|---|
| | 73 | endswith Case-sensitive ends-with. (PostgreSQL only. MySQL doesn't |
|---|
| | 74 | support case-sensitive LIKE statements; ``endswith`` will act |
|---|
| | 75 | like ``iendswith`` for MySQL.) |
|---|
| | 76 | istartswith Case-insensitive starts-with. |
|---|
| | 77 | iendswith Case-insensitive ends-with. |
|---|
| | 78 | range Range test: |
|---|
| | 79 | ``polls.get_list(pub_date__range=(start_date, end_date))`` |
|---|
| | 80 | returns all polls with a pub_date between ``start_date`` |
|---|
| | 81 | and ``end_date`` (inclusive). |
|---|
| | 82 | year For date/datetime fields, exact year match: |
|---|
| | 83 | ``polls.get_count(pub_date__year=2005)``. |
|---|
| | 84 | month For date/datetime fields, exact month match. |
|---|
| | 85 | day For date/datetime fields, exact day match. |
|---|
| | 86 | isnull True/False; does is IF NULL/IF NOT NULL lookup: |
|---|
| | 87 | ``polls.get_list(expire_date__isnull=True)``. |
|---|
| | 88 | =========== ============================================================== |
|---|