python - Django:datefield showing constant time -


यह मेरा मॉडल है:

  वर्ग संदेश (models.Model): status_choices = ( (U'read ', u'read'), (u'unread ', u'unread')) उपयोगकर्ता = मॉडल। फ़ॉरइंजकी (यूज़र) संदेश = मॉडल। टेक्स्टफिल्ड () स्थिति = मॉडल.कारफिल्ड (max_length = 6, विकल्प = स्थिति_कोरिस, डिफ़ॉल्ट = 'अपठित') प्रेषक = मॉडल। फ़ॉरविन्की (उपयोगकर्ता, संबंधित_नाम = "प्रेषक") तिथि = मॉडल.डेटफेल्ड (डिफ़ॉल्ट = datetime.date.today, संपादन योग्य = गलत)   < P> तो अब हर संदेश में "तारीख" फ़ील्ड "12:00 पूर्वाह्न 11 जुलाई 2012" पर सेट है। ऐसा क्यों है?   

datetime.date.today () समय मूल्यों को वापस नहीं करता है, इसलिए यह आधी रात को चूक है अपनी अंतिम पंक्ति को तारीख = मॉडलों में बदलें। डेटाटैमफिल्ड (डिफ़ॉल्ट = datetime.datetime.now, संपादन योग्य = गलत)

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -