class F
from django.db.models.expressions import F
An object capable of resolving references to existing query objects.
Ancestors (MRO)
- builtins.object
- django.db.models.expressions.Combinable
- django.db.models.expressions.F
Attribute | Value | Defined in |
---|---|---|
ADD |
+ |
django.db.models.expressions.Combinable |
BITAND |
& |
django.db.models.expressions.Combinable |
BITLEFTSHIFT |
<< |
django.db.models.expressions.Combinable |
BITOR |
| |
django.db.models.expressions.Combinable |
BITRIGHTSHIFT |
>> |
django.db.models.expressions.Combinable |
BITXOR |
# |
django.db.models.expressions.Combinable |
DIV |
/ |
django.db.models.expressions.Combinable |
MOD |
%% |
django.db.models.expressions.Combinable |
MUL |
* |
django.db.models.expressions.Combinable |
POW |
^ |
django.db.models.expressions.Combinable |
SUB |
- |
django.db.models.expressions.Combinable |
allowed_default |
False |
django.db.models.expressions.F |
def asc(self, **kwargs)
django.db.models.expressions.F
def asc(self, **kwargs):
return OrderBy(self, **kwargs)
def bitand(self, other)
django.db.models.expressions.Combinable
def bitand(self, other):
return self._combine(other, self.BITAND, False)
def bitleftshift(self, other)
django.db.models.expressions.Combinable
def bitleftshift(self, other):
return self._combine(other, self.BITLEFTSHIFT, False)
def bitor(self, other)
django.db.models.expressions.Combinable
def bitor(self, other):
return self._combine(other, self.BITOR, False)
def bitrightshift(self, other)
django.db.models.expressions.Combinable
def bitrightshift(self, other):
return self._combine(other, self.BITRIGHTSHIFT, False)
def bitxor(self, other)
django.db.models.expressions.Combinable
def bitxor(self, other):
return self._combine(other, self.BITXOR, False)
def copy(self)
django.db.models.expressions.F
def copy(self):
return copy.copy(self)
def deconstruct(obj)
django.db.models.expressions.F
Return a 3-tuple of class import path, positional arguments, and keyword arguments.
def deconstruct(obj):
"""
Return a 3-tuple of class import path, positional arguments,
and keyword arguments.
"""
# Fallback version
if path and type(obj) is klass:
module_name, _, name = path.rpartition(".")
else:
module_name = obj.__module__
name = obj.__class__.__name__
# Make sure it's actually there and not an inner class
module = import_module(module_name)
if not hasattr(module, name):
raise ValueError(
"Could not find object %s in %s.\n"
"Please note that you cannot serialize things like inner "
"classes. Please move the object into the main module "
"body to use migrations.\n"
"For more information, see "
"https://docs.djangoproject.com/en/%s/topics/migrations/"
"#serializing-values" % (name, module_name, get_docs_version())
)
return (
(
path
if path and type(obj) is klass
else f"{obj.__class__.__module__}.{name}"
),
obj._constructor_args[0],
obj._constructor_args[1],
)
def desc(self, **kwargs)
django.db.models.expressions.F
def desc(self, **kwargs):
return OrderBy(self, descending=True, **kwargs)
def replace_expressions(self, replacements)
django.db.models.expressions.F
def replace_expressions(self, replacements):
return replacements.get(self, self)
def resolve_expression(self, query=None, allow_joins=True, reuse=None, summarize=False, for_save=False)
django.db.models.expressions.F
def resolve_expression(
self, query=None, allow_joins=True, reuse=None, summarize=False, for_save=False
):
return query.resolve_ref(self.name, allow_joins, reuse, summarize)