      Company.objects.filter(num_employees__gt=F('num_chairs'))
  
      # Find companies that have at least twice as many employees
      # as chairs. Both the querysets below are equivalent.
      Company.objects.filter(num_employees__gt=F('num_chairs') * 2)
      Company.objects.filter(
          num_employees__gt=F('num_chairs') + F('num_chairs'))
  
      # How many chairs are needed for each company to seat all employees?
      >>> company = Company.objects.filter(
      ...    num_employees__gt=F('num_chairs')).annotate(
      ...    chairs_needed=F('num_employees') - F('num_chairs')).first()
 
</s> remove     Company.objects.filter(num_employees__gt=F('num_chairs'))
 </s> add     >>> Company.objects.filter(num_employees__gt=F('num_chairs')) </s> remove     from django.db.models import Count, F, Value
    from django.db.models.functions import Length, Upper
    from django.db.models.lookups import GreaterThan
 </s> add     >>> from django.db.models import Count, F, Value
    >>> from django.db.models.functions import Length, Upper
    >>> from django.db.models.lookups import GreaterThan </s> remove     * Both sides of a :class:`~django.db.models.ManyToManyField` relation::
 </s> add     * Both sides of a :class:`~django.db.models.ManyToManyField` relation
      :: </s> remove     >>>     avg_rating=Window(
    >>>         expression=Avg('rating'), **window,
    >>>     ),
    >>>     best=Window(
    >>>         expression=Max('rating'), **window,
    >>>     ),
    >>>     worst=Window(
    >>>         expression=Min('rating'), **window,
    >>>     ),
    >>> )
 </s> add     ...     avg_rating=Window(
    ...         expression=Avg('rating'), **window,
    ...     ),
    ...     best=Window(
    ...         expression=Max('rating'), **window,
    ...     ),
    ...     worst=Window(
    ...         expression=Min('rating'), **window,
    ...     ),
    ... ) </s> remove     >>> file_data = {'mugshot': SimpleUploadedFile('face.jpg', <file data>)}
 </s> add     >>> file_data = {'mugshot': SimpleUploadedFile('face.jpg', b"file data")}
    >>> Company.objects.filter(num_employees__gt=F('num_chairs') * 2)
    >>> Company.objects.filter(
    ...     num_employees__gt=F('num_chairs') + F('num_chairs'))
      Company.objects.filter(num_employees__gt=F('num_chairs'))
  
      # Find companies that have at least twice as many employees
      # as chairs. Both the querysets below are equivalent.
    >>> Company.objects.filter(num_employees__gt=F('num_chairs') * 2)
    >>> Company.objects.filter(
    ...     num_employees__gt=F('num_chairs') + F('num_chairs'))
    >>> Company.objects.filter(num_employees__gt=F('num_chairs') * 2)
    >>> Company.objects.filter(
    ...     num_employees__gt=F('num_chairs') + F('num_chairs'))
    >>> Company.objects.filter(num_employees__gt=F('num_chairs') * 2)
    >>> Company.objects.filter(
    ...     num_employees__gt=F('num_chairs') + F('num_chairs'))
  
      # How many chairs are needed for each company to seat all employees?
      >>> company = Company.objects.filter(
      ...    num_employees__gt=F('num_chairs')).annotate(
      ...    chairs_needed=F('num_employees') - F('num_chairs')).first()
keep keep keep keep replace replace replace keep keep keep keep keep
 Refs #34140 -- Corrected rst code-block and various formatting issues in docs. 
docs/ref/models/expressions.txt