F
Create F, Q, and Func objects with expressions.
Usage
F()Since attributes are used for constructing F objects, there may be collisions between field names and methods. For example, name is a reserved attribute, but the usual constructor can still be used: F('name').
See source for available spatial functions if django.contrib.gis is configured.
F creation supported as attributes: F.user == F('user'), F.user.created == F('user__created').
Q lookups supported as methods or operators: F.text.iexact(...) == Q(text__iexact=...), F.user.created >= ... == Q(user__created__gte=...).
Func objects also supported as methods: F.user.created.min() == Min('user__created').
Some Func objects can also be transformed into lookups, if registered: F.text.length() == Length(F('text')), F.text.length > 0 == Q(text__length__gt=0).
Classes
| Name | Description |
|---|---|
| distance |
Return Distance with support for lookups: <, <=, >, >=, within.
|
distance
Return Distance with support for lookups: <, <=, >, >=, within.
Usage
distance()Methods
| Name | Description |
|---|---|
| __eq__() |
Return Q object with lookup.
|
| __getattr__() | Return new [F][model_values.F] object with chained attribute. |
| __getitem__() |
Return field Substr or Right.
|
| __ne__() | Allow __ne=None lookup without custom queryset. |
| count() |
Return Count with optional field.
|
| find() |
Return StrIndex with str.find semantics.
|
| ljust() |
Return LPad with wrapped values.
|
| log() |
Return Log, by default Ln.
|
| replace() |
Return Replace with wrapped values.
|
| rjust() |
Return RPad with wrapped values.
|
__eq__()
Return Q object with lookup.
Usage
__eq__(value, lookup="")__getattr__()
Return new [F][model_values.F] object with chained attribute.
Usage
__getattr__(name)__getitem__()
Return field Substr or Right.
Usage
__getitem__(slc)__ne__()
Allow __ne=None lookup without custom queryset.
Usage
__ne__(value)count()
Return Count with optional field.
Usage
count(**extra)find()
Return StrIndex with str.find semantics.
Usage
find(sub, **extra)ljust()
Return LPad with wrapped values.
Usage
ljust(width, fill=" ", **extra)log()
Return Log, by default Ln.
Usage
log(base=math.e, **extra)replace()
Return Replace with wrapped values.
Usage
replace(old, new="", **extra)rjust()
Return RPad with wrapped values.
Usage
rjust(width, fill=" ", **extra)