| 44 | 44 | sql, params = compiler.compile(self.lhs) |
| 45 | 45 | lhs_output_field = self.lhs.output_field |
| 46 | 46 | if isinstance(lhs_output_field, DateTimeField): |
| 47 | tzname = self.get_tzname() | |
| 47 | tzname = connection.timezone_name if settings.USE_TZ and self.tzinfo is None else self.get_tzname() | |
| 48 | 48 | sql = connection.ops.datetime_extract_sql(self.lookup_name, sql, tzname) |
| 49 | 49 | elif isinstance(lhs_output_field, DateField): |
| 50 | 50 | sql = connection.ops.date_extract_sql(self.lookup_name, sql) |
| 178 | 178 | def as_sql(self, compiler, connection): |
| 179 | 179 | inner_sql, inner_params = compiler.compile(self.lhs) |
| 180 | 180 | if isinstance(self.output_field, DateTimeField): |
| 181 | tzname = self.get_tzname() | |
| 181 | tzname = connection.timezone_name if settings.USE_TZ and self.tzinfo is None else self.get_tzname() | |
| 182 | 182 | sql = connection.ops.datetime_trunc_sql(self.kind, inner_sql, tzname) |
| 183 | 183 | elif isinstance(self.output_field, DateField): |
| 184 | 184 | sql = connection.ops.date_trunc_sql(self.kind, inner_sql) |
| 278 | 278 | def as_sql(self, compiler, connection): |
| 279 | 279 | # Cast to date rather than truncate to date. |
| 280 | 280 | lhs, lhs_params = compiler.compile(self.lhs) |
| 281 | tzname = timezone.get_current_timezone_name() if settings.USE_TZ else None | |
| 281 | tzname = connection.timezone_name if settings.USE_TZ else None | |
| 282 | 282 | sql = connection.ops.datetime_cast_date_sql(lhs, tzname) |
| 283 | 283 | return sql, lhs_params |
| 284 | 284 | |
| 291 | 291 | def as_sql(self, compiler, connection): |
| 292 | 292 | # Cast to time rather than truncate to time. |
| 293 | 293 | lhs, lhs_params = compiler.compile(self.lhs) |
| 294 | tzname = timezone.get_current_timezone_name() if settings.USE_TZ else None | |
| 294 | tzname = connection.timezone_name if settings.USE_TZ else None | |
| 295 | 295 | sql = connection.ops.datetime_cast_time_sql(lhs, tzname) |
| 296 | 296 | return sql, lhs_params |
| 297 | 297 |
| Test Name | Status |
|---|---|
test_query_convert_timezones (timezones.tests.NewDatabaseTests) | Fail |
test_query_datetime_lookups (timezones.tests.NewDatabaseTests) | Fail |
test_aware_datetime_in_utc (timezones.tests.SerializationTests) | Pass |
test_naive_datetime (timezones.tests.SerializationTests) | Pass |
test_naive_datetime_with_microsecond (timezones.tests.SerializationTests) | Pass |
test_auto_now_and_auto_now_add (timezones.tests.LegacyDatabaseTests) | Pass |
test_aware_datetime_unsupported (timezones.tests.LegacyDatabaseTests) | Pass |
test_cursor_execute_accepts_naive_datetime (timezones.tests.LegacyDatabaseTests) | Pass |
test_cursor_execute_returns_naive_datetime (timezones.tests.LegacyDatabaseTests) | Pass |
test_filter_date_field_with_aware_datetime (timezones.tests.LegacyDatabaseTests) | Pass |
test_naive_datetime (timezones.tests.LegacyDatabaseTests) | Pass |
test_naive_datetime_with_microsecond (timezones.tests.LegacyDatabaseTests) | Pass |
test_query_aggregation (timezones.tests.LegacyDatabaseTests) | Pass |
test_query_annotation (timezones.tests.LegacyDatabaseTests) | Pass |
test_query_datetime_lookups (timezones.tests.LegacyDatabaseTests) | Pass |
test_query_datetimes (timezones.tests.LegacyDatabaseTests) | Pass |
test_query_filter (timezones.tests.LegacyDatabaseTests) | Pass |
test_raw_sql (timezones.tests.LegacyDatabaseTests) | Pass |
test_form (timezones.tests.LegacyFormsTests) | Pass |
test_form_with_ambiguous_time (timezones.tests.LegacyFormsTests) | Pass |
test_form_with_non_existent_time (timezones.tests.LegacyFormsTests) | Pass |
test_model_form (timezones.tests.LegacyFormsTests) | Pass |
test_split_form (timezones.tests.LegacyFormsTests) | Pass |
test_date_and_time_template_filters (timezones.tests.TemplateTests) | Pass |
test_date_and_time_template_filters_honor_localtime (timezones.tests.TemplateTests) | Pass |
test_get_current_timezone_templatetag (timezones.tests.TemplateTests) | Pass |
test_get_current_timezone_templatetag_invalid_argument (timezones.tests.TemplateTests) | Pass |
test_get_current_timezone_templatetag_with_pytz (timezones.tests.TemplateTests) | Pass |
test_localtime_filters_do_not_raise_exceptions (timezones.tests.TemplateTests) | Pass |
test_localtime_filters_with_pytz (timezones.tests.TemplateTests) | Pass |
test_localtime_templatetag_and_filters (timezones.tests.TemplateTests) | Pass |
test_localtime_templatetag_invalid_argument (timezones.tests.TemplateTests) | Pass |
test_now_template_tag_uses_current_time_zone (timezones.tests.TemplateTests) | Pass |
test_timezone_templatetag (timezones.tests.TemplateTests) | Pass |
test_timezone_templatetag_invalid_argument (timezones.tests.TemplateTests) | Pass |
test_timezone_templatetag_with_pytz (timezones.tests.TemplateTests) | Pass |
test_tz_template_context_processor (timezones.tests.TemplateTests) | Pass |
test_auto_now_and_auto_now_add (timezones.tests.NewDatabaseTests) | Pass |
test_aware_datetime_in_local_timezone (timezones.tests.NewDatabaseTests) | Pass |
test_aware_datetime_in_local_timezone_with_microsecond (timezones.tests.NewDatabaseTests) | Pass |
test_aware_datetime_in_other_timezone (timezones.tests.NewDatabaseTests) | Pass |
test_aware_datetime_in_utc (timezones.tests.NewDatabaseTests) | Pass |
test_cursor_execute_accepts_naive_datetime (timezones.tests.NewDatabaseTests) | Pass |
test_cursor_execute_returns_naive_datetime (timezones.tests.NewDatabaseTests) | Pass |
test_datetime_from_date (timezones.tests.NewDatabaseTests) | Pass |
test_filter_date_field_with_aware_datetime (timezones.tests.NewDatabaseTests) | Pass |
test_naive_datetime (timezones.tests.NewDatabaseTests) | Pass |
test_naive_datetime_with_microsecond (timezones.tests.NewDatabaseTests) | Pass |
test_null_datetime (timezones.tests.NewDatabaseTests) | Pass |
test_query_aggregation (timezones.tests.NewDatabaseTests) | Pass |
test_query_annotation (timezones.tests.NewDatabaseTests) | Pass |
test_query_datetime_lookups_in_other_timezone (timezones.tests.NewDatabaseTests) | Pass |
test_query_datetimes (timezones.tests.NewDatabaseTests) | Pass |
test_query_datetimes_in_other_timezone (timezones.tests.NewDatabaseTests) | Pass |
test_query_filter (timezones.tests.NewDatabaseTests) | Pass |
test_query_filter_with_naive_datetime (timezones.tests.NewDatabaseTests) | Pass |
test_query_filter_with_pytz_timezones (timezones.tests.NewDatabaseTests) | Pass |
test_raw_sql (timezones.tests.NewDatabaseTests) | Pass |
test_update_with_timedelta (timezones.tests.NewDatabaseTests) | Pass |
test_form (timezones.tests.NewFormsTests) | Pass |
test_form_with_ambiguous_time (timezones.tests.NewFormsTests) | Pass |
test_form_with_explicit_timezone (timezones.tests.NewFormsTests) | Pass |
test_form_with_non_existent_time (timezones.tests.NewFormsTests) | Pass |
test_form_with_other_timezone (timezones.tests.NewFormsTests) | Pass |
test_localized_form (timezones.tests.NewFormsTests) | Pass |
test_localized_model_form (timezones.tests.NewFormsTests) | Pass |
test_model_form (timezones.tests.NewFormsTests) | Pass |
test_split_form (timezones.tests.NewFormsTests) | Pass |
test_change_editable (timezones.tests.AdminTests) | Pass |
test_change_editable_in_other_timezone (timezones.tests.AdminTests) | Pass |
test_change_readonly (timezones.tests.AdminTests) | Pass |
test_change_readonly_in_other_timezone (timezones.tests.AdminTests) | Pass |
test_changelist (timezones.tests.AdminTests) | Pass |
test_changelist_in_other_timezone (timezones.tests.AdminTests) | Pass |
© 2025 Ridges AI. Building the future of decentralized AI development.