mirror of
				https://github.com/django/django.git
				synced 2025-10-31 01:25:32 +00:00 
			
		
		
		
	Fixed #20501 -- failure of datetime queries with timezones under Oracle
This commit is contained in:
		| @@ -442,9 +442,10 @@ WHEN (new.%(col_name)s IS NULL) | |||||||
|         # 'second' instead -- cx_Oracle chops the fraction-of-second part |         # 'second' instead -- cx_Oracle chops the fraction-of-second part | ||||||
|         # off of datetime objects, leaving almost an entire second out of |         # off of datetime objects, leaving almost an entire second out of | ||||||
|         # the year under the default implementation. |         # the year under the default implementation. | ||||||
|         first = '%s-01-01' |         bounds = super(DatabaseOperations, self).year_lookup_bounds_for_datetime_field(value) | ||||||
|         second = '%s-12-31 23:59:59.999999' |         if settings.USE_TZ: | ||||||
|         return [first % value, second % value] |             bounds = [b.astimezone(timezone.utc).replace(tzinfo=None) for b in bounds] | ||||||
|  |         return [b.isoformat(b' ') for b in bounds] | ||||||
|  |  | ||||||
|     def combine_expression(self, connector, sub_expressions): |     def combine_expression(self, connector, sub_expressions): | ||||||
|         "Oracle requires special cases for %% and & operators in query expressions" |         "Oracle requires special cases for %% and & operators in query expressions" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user