  =============
  
  .. code-block:: python
  
      from django.db.models import Count, F, Value
      from django.db.models.functions import Length, Upper
      from django.db.models.lookups import GreaterThan
  
      # Find companies that have more employees than chairs.
      Company.objects.filter(num_employees__gt=F('num_chairs'))
  
      # Find companies that have at least twice as many employees
 
</s> remove     Company.objects.filter(num_employees__gt=F('num_chairs'))
 </s> add     >>> Company.objects.filter(num_employees__gt=F('num_chairs')) </s> remove .. code-block:: python
 </s> add .. code-block:: pycon </s> remove     Company.objects.filter(num_employees__gt=F('num_chairs') * 2)
    Company.objects.filter(
        num_employees__gt=F('num_chairs') + F('num_chairs'))
 </s> add     >>> Company.objects.filter(num_employees__gt=F('num_chairs') * 2)
    >>> Company.objects.filter(
    ...     num_employees__gt=F('num_chairs') + F('num_chairs')) </s> remove     >>>     avg_rating=Window(
    >>>         expression=Avg('rating'),
    >>>         partition_by=[F('studio'), F('genre')],
    >>>         order_by='released__year',
    >>>         frame=ValueRange(start=-12, end=12),
    >>>     ),
    >>> )
 </s> add     ...     avg_rating=Window(
    ...         expression=Avg('rating'),
    ...         partition_by=[F('studio'), F('genre')],
    ...         order_by='released__year',
    ...         frame=ValueRange(start=-12, end=12),
    ...     ),
    ... ) </s> remove         def fancy_utility_function(s, ...):
 </s> add         def fancy_utility_function(s, *args, **kwargs):
    >>> from django.db.models import Count, F, Value
    >>> from django.db.models.functions import Length, Upper
    >>> from django.db.models.lookups import GreaterThan
  =============
  
  .. code-block:: python
  
    >>> from django.db.models import Count, F, Value
    >>> from django.db.models.functions import Length, Upper
    >>> from django.db.models.lookups import GreaterThan
    >>> from django.db.models import Count, F, Value
    >>> from django.db.models.functions import Length, Upper
    >>> from django.db.models.lookups import GreaterThan
    >>> from django.db.models import Count, F, Value
    >>> from django.db.models.functions import Length, Upper
    >>> from django.db.models.lookups import GreaterThan
  
      # Find companies that have more employees than chairs.
      Company.objects.filter(num_employees__gt=F('num_chairs'))
  
      # Find companies that have at least twice as many employees
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