Code

Opened 10 months ago

Closed 10 months ago

Last modified 9 months ago

#21186 closed Bug (fixed)

list_filter on a date field is not working as expected

Reported by: onlygoldi2201@… Owned by: nobody
Component: contrib.admin Version: master
Severity: Release blocker Keywords:
Cc: bmispelon@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I am new user of Django and i am learning it.

I expect books which are getting publish in future date in the current month/year to be shown when i select "this month" or "this year". But it's show results only till current date.

I am attaching some of snapshots of web page and code as well, please let me know if any other information is needed.

Attachments (3)

thismonth.png (143.6 KB) - added by anonymous 10 months ago.
thisyear.png (129.9 KB) - added by anonymous 10 months ago.
Anydate.png (131.7 KB) - added by anonymous 10 months ago.

Download all attachments as: .zip

Change History (10)

Changed 10 months ago by anonymous

Changed 10 months ago by anonymous

Changed 10 months ago by anonymous

comment:1 follow-up: Changed 10 months ago by ramiro

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Thanks for your report.

Which database backend are you using?

comment:2 Changed 10 months ago by ramiro

  • Triage Stage changed from Unreviewed to Accepted

We've been able to reproduce this with sqlite3 and MySQL

comment:3 Changed 10 months ago by bmispelon

  • Cc bmispelon@… added
  • Severity changed from Normal to Release blocker
  • Version changed from 1.5 to master

Some digging up indicates that the regression was introduced in bf0abe0ea6cb492810c5b4f9306a19c8afe603bb.

I reproduced the issue quite simply, using the following model/modeladmin:

class Foo(models.Model):
    publication_date = models.DateField()

class FooAdmin(admin.ModelAdmin):
    list_display = ['pk', 'publication_date']
    list_filter = ['publication_date']

I created four objects with the dates provided in the original report.

comment:4 Changed 10 months ago by Baptiste Mispelon <bmispelon@…>

  • Resolution set to fixed
  • Status changed from new to closed

In 8f51ba669aba94eea684ea3f3429fd8e39e70679:

Fixed #21186: Fixed regression when using date fields in the admin's list_filter.

Thanks to onlygoldi2201 for the report and to ramiro and apollo13
for the reviews.

comment:5 Changed 10 months ago by Baptiste Mispelon <bmispelon@…>

In c2a35d40db3eca728ac809a3ddb5e8fcec463bca:

[1.6.x] Fixed #21186: Fixed regression when using date fields in the admin's list_filter.

Thanks to onlygoldi2201 for the report and to ramiro and apollo13
for the reviews.

Backport of 8f51ba669aba94eea684ea3f3429fd8e39e70679 from master.

comment:6 in reply to: ↑ 1 Changed 10 months ago by anonymous

Replying to ramiro:

Thanks for your report.

Which database backend are you using?

I am using MySql.

comment:7 Changed 9 months ago by aaugustin

Whoops, sorry about that. Thanks everyone for the fix.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.