Opened 3 years ago
Last modified 3 years ago
#33075 closed Bug
'__date' returns None in MySQL while it returns date object in Sqlite3 — at Initial Version
Reported by: | pikicode | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | 3.2 |
Severity: | Normal | Keywords: | mysql |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
database: mysql 5.7
django version: 3.2
python version: 3.8.1
Model.objects.values('some_datetime_field__date',)
returns None in MYSQL
class Inbound(models.Model): effective_date = models.DateTimeField(null=False, blank=True) number = models.IntegerField() # other fields. daily_changes = Inbound.objects.all().values('effective_date__date')\ .annotate(total_change=Sum('number')). Inbound.objects.values('effective_date__date')
just returns Nones in Mysql
Note:
See TracTickets
for help on using tickets.