0

I have two models also including the datetimeField but the format and result is different. Did I miss somethings?

models.py:

class Order(models.Model):
start_date = models.DateTimeField(auto_now_add=True)

class Payment(models.Model):
timestamp = models.DateTimeField(auto_now_add=True)

def __str__(self):
    return f'{self.timestamp}'

setting.py:

LANGUAGE_CODE = 'zh-TW'

TIME_ZONE = 'Asia/Taipei'

USE_I18N = True

USE_L10N = True

USE_TZ = True

admin.py:

class OrderAdmin(admin.ModelAdmin):
list_display = ['user', 'ordered', 'billing_address', 'start_date', 
'payment','being_delivered', 'Received']

When I check the value in django admin:

    For Order: Aug. 1, 2020, 9:49 p.m.  
    For Payment: 2020-08-01 13:50:01.368611+00:00
Hugo Yu
  • 105
  • 9
  • How did you check the values in Django admin? Did you add any ModelAdmin classes? – JPG Aug 01 '20 at 14:34
  • Yes, I have added ModelAdmin classes and also the templates is show the same result as same as the django admin – Hugo Yu Aug 01 '20 at 15:32

0 Answers0