MCPcopy
hub / github.com/django/django / year_lookup_bounds

Method year_lookup_bounds

django/db/models/lookups.py:705–720  ·  view source on GitHub ↗
(self, connection, year)

Source from the content-addressed store, hash-verified

703
704class YearLookup(Lookup):
705 def year_lookup_bounds(self, connection, year):
706 from django.db.models.functions import ExtractIsoYear
707
708 iso_year = isinstance(self.lhs, ExtractIsoYear)
709 output_field = self.lhs.lhs.output_field
710 if isinstance(output_field, DateTimeField):
711 bounds = connection.ops.year_lookup_bounds_for_datetime_field(
712 year,
713 iso_year=iso_year,
714 )
715 else:
716 bounds = connection.ops.year_lookup_bounds_for_date_field(
717 year,
718 iso_year=iso_year,
719 )
720 return bounds
721
722 def as_sql(self, compiler, connection):
723 # Avoid the extract operation if the rhs is a direct value to allow

Callers 1

as_sqlMethod · 0.95

Tested by

no test coverage detected