mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #25470 -- Avoided unnecessary, expensive DATETIME typecast on MySQL.
This commit is contained in:
parent
0dbe897ab5
commit
0f6d51e6a0
3 changed files with 42 additions and 12 deletions
|
@ -1,6 +1,7 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models
|
||||
from django.utils import timezone
|
||||
from django.utils.encoding import python_2_unicode_compatible
|
||||
|
||||
|
||||
|
@ -8,6 +9,7 @@ from django.utils.encoding import python_2_unicode_compatible
|
|||
class Article(models.Model):
|
||||
title = models.CharField(max_length=100)
|
||||
pub_date = models.DateField()
|
||||
pub_datetime = models.DateTimeField(default=timezone.now())
|
||||
|
||||
categories = models.ManyToManyField("Category", related_name="articles")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue