#18969: ORM filtering with "year" lookup for dates ---------------------------------+-------------------- Reporter: saippuakauppias | Owner: nobody Type: Bug | Status: new Component: ORM aggregation | Version: 1.3 Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 ---------------------------------+-------------------- When I do query with lookup in orm:
{{{ Document.objects.filter(given_on__year=1).values_list('given_on', flat=True) }}} or {{{ Document.objects.filter(given_on__year='0001').values_list('given_on', flat=True) }}} I get results: {{{ [datetime.date(2012, 8, 31), datetime.date(2012, 8, 31), datetime.date(2012, 8, 29), '...(remaining elements truncated)...'] }}} But I would expect dates in interval 0001-01-01 ... 0001-12-31 (YYYY-MM- DD). Generated SQL query: {{{ print Document.objects.filter(given_on__year='0001').values_list('given_on').query }}} {{{ SELECT "documents_document"."given_on" FROM "documents_document" WHERE "documents_document"."given_on" BETWEEN 1-01-01 00:00:00 and 1-12-31 23:59:59.999999 ORDER BY "documents_document"."created_on" DESC }}} In django not possible give results with first year. PS: question in [http://stackoverflow.com/questions/12425853/postgresql- between-with-datetime stackoverflow] PPS: tested in Django 1.3.2 version -- Ticket URL: <https://code.djangoproject.com/ticket/18969> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.