|
45 | 45 |
|
46 | 46 | class FilterLookups:
|
47 | 47 | EQ = 'eq'
|
| 48 | + """`Equal` operator""" |
| 49 | + |
48 | 50 | NE = 'ne'
|
| 51 | + """`Not equal` operator""" |
| 52 | + |
49 | 53 | GE = 'ge'
|
| 54 | + """`Greater or equal` operator""" |
| 55 | + |
50 | 56 | GT = 'gt'
|
| 57 | + """`Greater than` operator""" |
| 58 | + |
51 | 59 | LE = 'le'
|
| 60 | + """`Less or equal` operator""" |
| 61 | + |
52 | 62 | LT = 'lt'
|
| 63 | + """`Less then` operator""" |
53 | 64 |
|
54 | 65 | IN = 'in'
|
| 66 | + """`In` operator""" |
| 67 | + |
55 | 68 | OUT = 'out'
|
| 69 | + """`Not in` operator""" |
56 | 70 |
|
57 | 71 | NULL = 'null'
|
| 72 | + """`null` operator""" |
58 | 73 |
|
59 | 74 | LIKE = 'like'
|
| 75 | + """`like` operator""" |
| 76 | + |
60 | 77 | I_LIKE = 'ilike'
|
| 78 | + """`Case-insensitive like` operator""" |
61 | 79 |
|
62 | 80 | @classmethod
|
63 | 81 | def numeric(cls, with_null=True):
|
| 82 | + """ |
| 83 | + Returns the default lookups for numeric fields. |
| 84 | +
|
| 85 | + :param with_null: if true, includes the `null` lookup, defaults to True |
| 86 | + :type with_null: bool, optional |
| 87 | + :return: a set with the default lookups. |
| 88 | + :rtype: set |
| 89 | + """ |
64 | 90 | return cls._add_null(
|
65 | 91 | {cls.EQ, cls.NE, cls.GE, cls.GT, cls.LT, cls.LE, cls.IN, cls.OUT}, with_null,
|
66 | 92 | )
|
67 | 93 |
|
68 | 94 | @classmethod
|
69 | 95 | def string(cls, with_null=True):
|
| 96 | + """ |
| 97 | + Returns the default lookups for string fields. |
| 98 | +
|
| 99 | + :param with_null: if true, includes the `null` lookup, defaults to True |
| 100 | + :type with_null: bool, optional |
| 101 | + :return: a set with the default lookups. |
| 102 | + :rtype: set |
| 103 | + """ |
70 | 104 | return cls._add_null({cls.EQ, cls.NE, cls.IN, cls.OUT, cls.LIKE, cls.I_LIKE}, with_null)
|
71 | 105 |
|
72 | 106 | @classmethod
|
73 | 107 | def boolean(cls, with_null=True):
|
| 108 | + """ |
| 109 | + Returns the default lookups for boolean fields. |
| 110 | +
|
| 111 | + :param with_null: if true, includes the `null` lookup, defaults to True |
| 112 | + :type with_null: bool, optional |
| 113 | + :return: a set with the default lookups. |
| 114 | + :rtype: set |
| 115 | + """ |
74 | 116 | return cls._add_null({cls.EQ, cls.NE}, with_null)
|
75 | 117 |
|
76 | 118 | @classmethod
|
|
0 commit comments