Opened 19 years ago

Last modified 15 years ago

#1104 closed enhancement

Correct DateField to not include Time — at Version 1

Reported by: mildly@… Owned by: Adrian Holovaty
Component: Metasystem Version: dev
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by Adrian Holovaty)

Index: django/core/meta/fields.py
===================================================================
--- django/core/meta/fields.py  (revision 1764)
+++ django/core/meta/fields.py  (working copy)
@@ -391,9 +391,9 @@

     def get_db_prep_lookup(self, lookup_type, value):
         if lookup_type == 'range':
-            value = [str(v) for v in value]
+            value = [v.strftime("%Y-%m-%d") for v in value]
         else:
-            value = str(value)
+            value = value.strftime("%Y-%m-%d")
         return Field.get_db_prep_lookup(self, lookup_type, value)

     def pre_save(self, value, add):

Change History (1)

comment:1 by Adrian Holovaty, 19 years ago

Description: modified (diff)

Changed formatting in description.

Note: See TracTickets for help on using tickets.
Back to Top