Ticket #24596: 0001-get_db_prep_value-on-year_lookup_bounds_for_date-dat.patch

File 0001-get_db_prep_value-on-year_lookup_bounds_for_date-dat.patch, 1.5 KB (added by Andreas Nüßlein, 3 years ago)
  • django/db/models/fields/__init__.py

    From 00c3ba2f196a3a04fb102a822474c896a9f1719e Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Andreas=20N=C3=BC=C3=9Flein?= <andreas@nuessle.in>
    Date: Tue, 7 Apr 2015 16:54:35 +0200
    Subject: [PATCH] get_db_prep_value on
     year_lookup_bounds_for_date/datetime_field
    
    ---
     django/db/models/fields/__init__.py | 8 ++++++--
     1 file changed, 6 insertions(+), 2 deletions(-)
    
    diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
    index b305330..ca0863f 100644
    a b class Field(RegisterLookupMixin): 
    776776            return []
    777777        elif lookup_type == 'year':
    778778            if isinstance(self, DateTimeField):
    779                 return connection.ops.year_lookup_bounds_for_datetime_field(value)
     779                values = connection.ops.year_lookup_bounds_for_datetime_field(value)
     780                return [self.get_db_prep_value(v, connection=connection,
     781                                           prepared=prepared) for v in values]
    780782            elif isinstance(self, DateField):
    781                 return connection.ops.year_lookup_bounds_for_date_field(value)
     783                values = connection.ops.year_lookup_bounds_for_date_field(value)
     784                return [self.get_db_prep_value(v, connection=connection,
     785                                           prepared=prepared) for v in values]
    782786            else:
    783787                return [value]          # this isn't supposed to happen
    784788        else:
Back to Top