Opened 4 months ago
Closed 4 months ago
#35994 closed Bug (invalid)
WeekArchiveView sometimes gets the next week year wrong in the last week of the year
Description ¶
In some cases - for example ISO or Monday start weeks in 2024, the last week of the year has the next week set as week 1 of 2024, and not week 1 of 2025.
Sample code:
class TicketScheduleWeekView(WeekArchiveView): """View of tickets scheduled for a week.""" # queryset = ## Queryset deleted as its quite large date_field = "date" week_format = "%W" year_format = "%Y" allow_future = True allow_empty = True
Given the following URL definition:
path("ticketschedule/<int:year>/<int:week>/", views.TicketScheduleWeekView.as_view(), name="ticket-schedule-week"),
We get for end of year links:-
/ticketschedule/2023/51/
- next week link is/ticketschedule/2023/52/
/ticketschedule/2024/52/
- next week link is/ticketschedule/2024/1/
/ticketschedule/2024/51/
- next week link is/ticketschedule/2024/52/
/ticketschedule/2024/52/
- next week link is/ticketschedule/2024/1/
wrong
Note:
See TracTickets
for help on using tickets.
Apologies. When looking deeper into this I discovered that I had the following in the template:-
when it should have been