Code

Ticket #14711: dates.diff

File dates.diff, 1.6 KB (added by msundstr, 3 years ago)

Patch for dates.py

Line 
1Index: django/views/generic/dates.py
2===================================================================
3--- django/views/generic/dates.py       (revision 14597)
4+++ django/views/generic/dates.py       (working copy)
5@@ -70,7 +70,7 @@
6         Get the previous valid month.
7         """
8         first_day, last_day = _month_bounds(date)
9-        prev = (first_day - datetime.timedelta(days=1)).replace(day=1)
10+        prev = (first_day - datetime.timedelta(days=1))
11         return _get_next_prev_month(self, prev, is_previous=True, use_first_day=True)
12 
13 
14@@ -514,7 +514,7 @@
15     This is a bit complicated since it handles both next and previous months
16     and days (for MonthArchiveView and DayArchiveView); hence the coupling to generic_view.
17 
18-    However in essance the logic comes down to:
19+    However in essence the logic comes down to:
20 
21         * If allow_empty and allow_future are both true, this is easy: just
22           return the naive result (just the next/previous day or month,
23@@ -544,7 +544,7 @@
24     # whose date_field is at least (greater than/less than) the given
25     # naive result
26     else:
27-        # Construct a lookup and an ordering depending on weather we're doing
28+        # Construct a lookup and an ordering depending on whether we're doing
29         # a previous date or a next date lookup.
30         if is_previous:
31             lookup = {'%s__lte' % date_field: naive_result}
32@@ -567,7 +567,7 @@
33         result = result.date()
34 
35     # For month views, we always want to have a date that's the first of the
36-    # month for consistancy's sake.
37+    # month for consistency's sake.
38     if result and use_first_day:
39         result = result.replace(day=1)
40