diff --git a/docs/ref/models/expressions.txt b/docs/ref/models/expressions.txt index 66bb905147..daf8440512 100644 --- a/docs/ref/models/expressions.txt +++ b/docs/ref/models/expressions.txt @@ -214,6 +214,15 @@ directly support ``output_field`` you will need to wrap the expression with expires=ExpressionWrapper( F('active_at') + F('duration'), output_field=DateTimeField())) +When referencing relational fields such as ``ForeignKey``, ``F()`` returns the +primary key value rather than a model instance:: + + >> car = Company.objects.annotate(built_by=F('manufacturer'))[0] + >> car.manufacturer + + >> car.built_by + 3 + .. _func-expressions: ``Func()`` expressions