Skip to content
Newer
Older
100644 321 lines (275 sloc) 10.8 KB
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
1 import datetime
2 from django.db.models.query import QuerySet
3f35a48 @yml Add the machinery to support i18n based on a patch provided by Leidel…
yml authored Dec 6, 2008
3 from django.template.defaultfilters import date
4 from django.utils.translation import ugettext, ugettext_lazy as _
92b17cc @RockHoward day names in calendars, start of week support
RockHoward authored Dec 16, 2008
5 from django.utils.dates import WEEKDAYS, WEEKDAYS_ABBR
2ca6b1f @winhamwr Refactored all settings manipulation in to a schedule.conf.settings m…
winhamwr authored Jul 2, 2009
6 from schedule.conf.settings import FIRST_DAY_OF_WEEK, SHOW_CANCELLED_OCCURRENCES
42fbaa0 @thauber added OccurrenceReplacer to the periods
thauber authored Apr 7, 2009
7 from schedule.models import Occurrence
8 from schedule.utils import OccurrenceReplacer
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
9
92b17cc @RockHoward day names in calendars, start of week support
RockHoward authored Dec 16, 2008
10 weekday_names = []
11 weekday_abbrs = []
2ca6b1f @winhamwr Refactored all settings manipulation in to a schedule.conf.settings m…
winhamwr authored Jul 2, 2009
12 if FIRST_DAY_OF_WEEK == 1:
92b17cc @RockHoward day names in calendars, start of week support
RockHoward authored Dec 16, 2008
13 # The calendar week starts on Monday
14 for i in range(7):
15 weekday_names.append( WEEKDAYS[i] )
16 weekday_abbrs.append( WEEKDAYS_ABBR[i] )
17 else:
18 # The calendar week starts on Sunday, not Monday
19 weekday_names.append( WEEKDAYS[6] )
20 weekday_abbrs.append( WEEKDAYS_ABBR[6] )
21 for i in range(6):
22 weekday_names.append( WEEKDAYS[i] )
23 weekday_abbrs.append( WEEKDAYS_ABBR[i] )
24
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
25 class Period(object):
26 '''
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
27 This class represents a period of time. It can return a set of occurrences
603eb3e @RockHoward Added convenience functions for periods and associated tests
RockHoward authored Dec 11, 2008
28 based on its events, and its time period (start and end).
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
29 '''
888d35d @thauber Working on some optimization
thauber authored Apr 10, 2009
30 def __init__(self, events, start, end, parent_persisted_occurrences = None,
31 occurrence_pool=None):
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
32 self.start = start
33 self.end = end
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
34 self.events = events
888d35d @thauber Working on some optimization
thauber authored Apr 10, 2009
35 self.occurrence_pool = occurrence_pool
48b1e56 @thauber Added Year period and an optimizations thanks to Bartek Gorny
thauber authored Apr 6, 2009
36 if parent_persisted_occurrences is not None:
37 self._persisted_occurrences = parent_persisted_occurrences
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
38
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
39 def __eq__(self, period):
40 return self.start==period.start and self.end==period.end and self.events==period.events
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
41
42 def _get_sorted_occurrences(self):
43 occurrences = []
888d35d @thauber Working on some optimization
thauber authored Apr 10, 2009
44 if hasattr(self, "occurrence_pool") and self.occurrence_pool is not None:
45 for occurrence in self.occurrence_pool:
46 if occurrence.start < self.end and occurrence.end >self.start:
47 occurrences.append(occurrence)
48 return occurrences
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
49 for event in self.events:
0b52ab8 @bartekgorny Solution to the problem of missing occurrences (it also makes the log…
bartekgorny authored Apr 15, 2009
50 event_occurrences = event.get_occurrences(self.start, self.end)
ff312a9 @thauber Added first try at persisted occurrences. This could is not stable, a…
thauber authored Jan 19, 2009
51 occurrences += event_occurrences
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
52 return sorted(occurrences)
e12f09f @bartekgorny Optimisation part 2 - storing occurrences as "volatile attribute"
bartekgorny authored Apr 27, 2009
53
54 def cached_get_sorted_occurrences(self):
55 if hasattr(self, '_occurrences'):
56 return self._occurrences
57 occs = self._get_sorted_occurrences()
58 self._occurrences = occs
59 return occs
60 occurrences = property(cached_get_sorted_occurrences)
48b1e56 @thauber Added Year period and an optimizations thanks to Bartek Gorny
thauber authored Apr 6, 2009
61
62 def get_persisted_occurrences(self):
63 if hasattr(self, '_persisted_occurrenes'):
64 return self._persisted_occurrences
65 else:
66 self._persisted_occurrences = Occurrence.objects.filter(event__in = self.events)
67 return self._persisted_occurrences
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
68
69 def classify_occurrence(self, occurrence):
2ca6b1f @winhamwr Refactored all settings manipulation in to a schedule.conf.settings m…
winhamwr authored Jul 2, 2009
70 if occurrence.cancelled and not SHOW_CANCELLED_OCCURRENCES:
71 return
603eb3e @RockHoward Added convenience functions for periods and associated tests
RockHoward authored Dec 11, 2008
72 if occurrence.start > self.end or occurrence.end < self.start:
73 return None
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
74 started = False
75 ended = False
73388da @yml Add a management command to laod some smaple data in the db. Add some…
yml authored Nov 11, 2008
76 if occurrence.start >= self.start and occurrence.start < self.end:
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
77 started = True
73388da @yml Add a management command to laod some smaple data in the db. Add some…
yml authored Nov 11, 2008
78 if occurrence.end >=self.start and occurrence.end< self.end:
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
79 ended = True
80 if started and ended:
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
81 return {'occurrence': occurrence, 'class': 1}
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
82 elif started:
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
83 return {'occurrence': occurrence, 'class': 0}
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
84 elif ended:
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
85 return {'occurrence': occurrence, 'class': 3}
86 # it existed during this period but it didnt begin or end within it
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
87 # so it must have just continued
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
88 return {'occurrence': occurrence, 'class': 2}
89
4e2c353 @thauber Fixed test and bug withPeriods.py get_sorted_occurrences, changed get…
thauber authored Nov 11, 2008
90 def get_occurrence_partials(self):
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
91 occurrence_dicts = []
92 for occurrence in self.occurrences:
93 occurrence = self.classify_occurrence(occurrence)
94 if occurrence:
95 occurrence_dicts.append(occurrence)
96 return occurrence_dicts
73388da @yml Add a management command to laod some smaple data in the db. Add some…
yml authored Nov 11, 2008
97
4e2c353 @thauber Fixed test and bug withPeriods.py get_sorted_occurrences, changed get…
thauber authored Nov 11, 2008
98 def get_occurrences(self):
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
99 return self.occurrences
100
603eb3e @RockHoward Added convenience functions for periods and associated tests
RockHoward authored Dec 11, 2008
101 def has_occurrences(self):
102 for occurrence in self.occurrences:
103 occurrence = self.classify_occurrence(occurrence)
104 if occurrence:
105 return True
106 return False
107
108 def get_time_slot(self, start, end ):
109 if start >= self.start and end <= self.end:
110 return Period( self.events, start, end )
111 return None
112
48b1e56 @thauber Added Year period and an optimizations thanks to Bartek Gorny
thauber authored Apr 6, 2009
113 class Year(Period):
114 def __init__(self, events, date=None, parent_persisted_occurrences=None):
115 if date is None:
116 date = datetime.datetime.now()
117 start, end = self._get_year_range(date)
118 super(Year, self).__init__(events, start, end, parent_persisted_occurrences)
2ca6b1f @winhamwr Refactored all settings manipulation in to a schedule.conf.settings m…
winhamwr authored Jul 2, 2009
119
48b1e56 @thauber Added Year period and an optimizations thanks to Bartek Gorny
thauber authored Apr 6, 2009
120 def get_months(self):
121 months = []
122 month_start = self.start
123 for i in range(12):
888d35d @thauber Working on some optimization
thauber authored Apr 10, 2009
124 month = Month(self.events, month_start,
125 self.get_persisted_occurrences(), self.occurrences)
48b1e56 @thauber Added Year period and an optimizations thanks to Bartek Gorny
thauber authored Apr 6, 2009
126 months.append(month)
127 month_start = month.next_month()
128 return months
2ca6b1f @winhamwr Refactored all settings manipulation in to a schedule.conf.settings m…
winhamwr authored Jul 2, 2009
129
48b1e56 @thauber Added Year period and an optimizations thanks to Bartek Gorny
thauber authored Apr 6, 2009
130 def next_year(self):
131 return self.end
6fdcf9a @bartekgorny Added generic aliases to prev_*/next_* methods
bartekgorny authored Apr 11, 2009
132 next = next_year
2ca6b1f @winhamwr Refactored all settings manipulation in to a schedule.conf.settings m…
winhamwr authored Jul 2, 2009
133
48b1e56 @thauber Added Year period and an optimizations thanks to Bartek Gorny
thauber authored Apr 6, 2009
134 def prev_year(self):
135 return datetime.datetime(
136 self.start.year-1, self.start.month, self.start.day)
6fdcf9a @bartekgorny Added generic aliases to prev_*/next_* methods
bartekgorny authored Apr 10, 2009
137 prev = prev_year
2ca6b1f @winhamwr Refactored all settings manipulation in to a schedule.conf.settings m…
winhamwr authored Jul 2, 2009
138
48b1e56 @thauber Added Year period and an optimizations thanks to Bartek Gorny
thauber authored Apr 6, 2009
139 def _get_year_range(self, year):
140 start = datetime.datetime(year.year, datetime.datetime.min.month,
141 datetime.datetime.min.day)
142 end = datetime.datetime(year.year+1, datetime.datetime.min.month,
143 datetime.datetime.min.day)
144 return start, end
2ca6b1f @winhamwr Refactored all settings manipulation in to a schedule.conf.settings m…
winhamwr authored Jul 2, 2009
145
48b1e56 @thauber Added Year period and an optimizations thanks to Bartek Gorny
thauber authored Apr 6, 2009
146 def __unicode__(self):
147 return self.start.strftime('%Y')
2ca6b1f @winhamwr Refactored all settings manipulation in to a schedule.conf.settings m…
winhamwr authored Jul 2, 2009
148
149
603eb3e @RockHoward Added convenience functions for periods and associated tests
RockHoward authored Dec 11, 2008
150
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
151 class Month(Period):
152 """
153 The month period has functions for retrieving the week periods within this period
154 and day periods within the date.
155 """
888d35d @thauber Working on some optimization
thauber authored Apr 10, 2009
156 def __init__(self, events, date=None, parent_persisted_occurrences=None,
157 occurrence_pool=None):
8d19da4 @thauber * Added the start to the documentation.
thauber authored Mar 31, 2009
158 if date is None:
159 date = datetime.datetime.now()
4a33d2c @thauber fixed small bugs
thauber authored Oct 30, 2008
160 start, end = self._get_month_range(date)
2ca6b1f @winhamwr Refactored all settings manipulation in to a schedule.conf.settings m…
winhamwr authored Jul 2, 2009
161 super(Month, self).__init__(events, start, end,
888d35d @thauber Working on some optimization
thauber authored Apr 10, 2009
162 parent_persisted_occurrences, occurrence_pool)
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
163
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
164 def get_weeks(self):
165 date = self.start
166 weeks = []
167 while date < self.end:
168 #list events to make it only one query
888d35d @thauber Working on some optimization
thauber authored Apr 10, 2009
169 week = Week(self.events, date, self.get_persisted_occurrences(),
0e86271 @bartekgorny Optimisation part 1 - passing occurrences as occurrence_pool
bartekgorny authored Apr 27, 2009
170 self.occurrences)
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
171 weeks.append(week)
172 date = week.next_week()
173 return weeks
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
174
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
175 def get_days(self):
176 date = self.start
177 days = []
178 while date < self.end:
179 #list events to make it only one query
888d35d @thauber Working on some optimization
thauber authored Apr 10, 2009
180 day = Day(self.events, date, self.get_persisted_occurrences(),
0e86271 @bartekgorny Optimisation part 1 - passing occurrences as occurrence_pool
bartekgorny authored Apr 27, 2009
181 self.occurrences)
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
182 days.append(day)
183 date = day.next_day()
184 return days
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
185
6539d7e @RockHoward many new views and templates
RockHoward authored Dec 19, 2008
186 def get_day(self, daynumber ):
187 date = self.start
188 if daynumber > 1:
189 date += datetime.timedelta(days=daynumber-1)
0e86271 @bartekgorny Optimisation part 1 - passing occurrences as occurrence_pool
bartekgorny authored Apr 27, 2009
190 return Day(self.events, date, self.get_persisted_occurrences(), self.occurrences)
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
191
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
192 def next_month(self):
193 return self.end
6fdcf9a @bartekgorny Added generic aliases to prev_*/next_* methods
bartekgorny authored Apr 10, 2009
194 next = next_month
2ca6b1f @winhamwr Refactored all settings manipulation in to a schedule.conf.settings m…
winhamwr authored Jul 2, 2009
195
dd29dfb @thauber added the ability to move through months in the template: sending all…
thauber authored Nov 11, 2008
196 def prev_month(self):
603eb3e @RockHoward Added convenience functions for periods and associated tests
RockHoward authored Dec 11, 2008
197 return (self.start - datetime.timedelta(days=1)).replace(day=1)
6fdcf9a @bartekgorny Added generic aliases to prev_*/next_* methods
bartekgorny authored Apr 10, 2009
198 prev = prev_month
603eb3e @RockHoward Added convenience functions for periods and associated tests
RockHoward authored Dec 11, 2008
199
200 def current_year(self):
201 return datetime.datetime.min.replace(year=self.start.year)
202
203 def prev_year(self):
204 return datetime.datetime.min.replace(year=self.start.year-1)
205
206 def next_year(self):
207 return datetime.datetime.min.replace(year=self.start.year+1)
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
208
4a33d2c @thauber fixed small bugs
thauber authored Oct 30, 2008
209 def _get_month_range(self, month):
48b1e56 @thauber Added Year period and an optimizations thanks to Bartek Gorny
thauber authored Apr 6, 2009
210 year = month.year
211 month = month.month
212 start = datetime.datetime.min.replace(year=year, month=month)
213 if month == 12:
214 end = start.replace(month=1, year=year+1)
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
215 else:
48b1e56 @thauber Added Year period and an optimizations thanks to Bartek Gorny
thauber authored Apr 6, 2009
216 end = start.replace(month=month+1)
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
217 return start, end
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
218
3f35a48 @yml Add the machinery to support i18n based on a patch provided by Leidel…
yml authored Dec 6, 2008
219 def __unicode__(self):
48b1e56 @thauber Added Year period and an optimizations thanks to Bartek Gorny
thauber authored Apr 6, 2009
220 return self.name()
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
221
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
222 def name(self):
223 return self.start.strftime('%B')
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
224
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
225 def year(self):
226 return self.start.strftime('%Y')
227
228 class Week(Period):
229 """
230 The Week period that has functions for retrieving Day periods within it
231 """
2ca6b1f @winhamwr Refactored all settings manipulation in to a schedule.conf.settings m…
winhamwr authored Jul 2, 2009
232 def __init__(self, events, date=None, parent_persisted_occurrences=None,
888d35d @thauber Working on some optimization
thauber authored Apr 10, 2009
233 occurrence_pool=None):
8d19da4 @thauber * Added the start to the documentation.
thauber authored Mar 31, 2009
234 if date is None:
235 date = datetime.datetime.now()
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
236 start, end = self._get_week_range(date)
2ca6b1f @winhamwr Refactored all settings manipulation in to a schedule.conf.settings m…
winhamwr authored Jul 2, 2009
237 super(Week, self).__init__(events, start, end,
888d35d @thauber Working on some optimization
thauber authored Apr 10, 2009
238 parent_persisted_occurrences, occurrence_pool)
2ca6b1f @winhamwr Refactored all settings manipulation in to a schedule.conf.settings m…
winhamwr authored Jul 2, 2009
239
ba22847 @bartekgorny added prev/next methods to Week
bartekgorny authored Apr 29, 2009
240 def prev_week(self):
241 return self.start - datetime.timedelta(days=7)
242 prev = prev_week
243
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
244 def next_week(self):
245 return self.end
ba22847 @bartekgorny added prev/next methods to Week
bartekgorny authored Apr 28, 2009
246 next = next_week
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
247
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
248 def get_days(self):
249 days = []
250 date = self.start
251 while date < self.end:
888d35d @thauber Working on some optimization
thauber authored Apr 10, 2009
252 day = Day(self.events, date, self.get_persisted_occurrences(),
0e86271 @bartekgorny Optimisation part 1 - passing occurrences as occurrence_pool
bartekgorny authored Apr 27, 2009
253 self.occurrences)
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
254 days.append(day)
255 date = day.next_day()
256 return days
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
257
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
258 def _get_week_range(self, week):
259 if isinstance(week, datetime.datetime):
260 week = week.date()
92b17cc @RockHoward day names in calendars, start of week support
RockHoward authored Dec 16, 2008
261 # Adjust the start datetime to midnight of the week datetime
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
262 start = datetime.datetime.combine(week, datetime.time.min)
92b17cc @RockHoward day names in calendars, start of week support
RockHoward authored Dec 16, 2008
263 # Adjust the start datetime to Monday or Sunday of the current week
264 sub_days = 0
2ca6b1f @winhamwr Refactored all settings manipulation in to a schedule.conf.settings m…
winhamwr authored Jul 2, 2009
265 if FIRST_DAY_OF_WEEK == 1:
92b17cc @RockHoward day names in calendars, start of week support
RockHoward authored Dec 16, 2008
266 # The week begins on Monday
267 sub_days = start.isoweekday() - 1
268 else:
269 # The week begins on Sunday
270 sub_days = start.isoweekday()
271 if sub_days == 7:
272 sub_days = 0
273 if sub_days > 0:
274 start = start - datetime.timedelta(days=sub_days)
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
275 end = start + datetime.timedelta(days=7)
276 return start, end
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
277
3f35a48 @yml Add the machinery to support i18n based on a patch provided by Leidel…
yml authored Dec 6, 2008
278 def __unicode__(self):
279 date_format = u'l, %s' % ugettext("DATE_FORMAT")
280 return ugettext('Week: %(start)s-%(end)s') % {
281 'start': date(self.start, date_format),
282 'end': date(self.end, date_format),
283 }
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
284
285 class Day(Period):
888d35d @thauber Working on some optimization
thauber authored Apr 10, 2009
286 def __init__(self, events, date=None, parent_persisted_occurrences=None,
287 occurrence_pool=None):
8d19da4 @thauber * Added the start to the documentation.
thauber authored Mar 31, 2009
288 if date is None:
289 date = datetime.datetime.now()
48b1e56 @thauber Added Year period and an optimizations thanks to Bartek Gorny
thauber authored Apr 6, 2009
290 start, end = self._get_day_range(date)
2ca6b1f @winhamwr Refactored all settings manipulation in to a schedule.conf.settings m…
winhamwr authored Jul 2, 2009
291 super(Day, self).__init__(events, start, end,
888d35d @thauber Working on some optimization
thauber authored Apr 10, 2009
292 parent_persisted_occurrences, occurrence_pool)
48b1e56 @thauber Added Year period and an optimizations thanks to Bartek Gorny
thauber authored Apr 6, 2009
293
294 def _get_day_range(self, date):
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
295 if isinstance(date, datetime.datetime):
296 date = date.date()
48b1e56 @thauber Added Year period and an optimizations thanks to Bartek Gorny
thauber authored Apr 6, 2009
297 start = datetime.datetime.combine(date, datetime.time.min)
298 end = start + datetime.timedelta(days=1)
299 return start, end
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
300
3f35a48 @yml Add the machinery to support i18n based on a patch provided by Leidel…
yml authored Dec 6, 2008
301 def __unicode__(self):
302 date_format = u'l, %s' % ugettext("DATE_FORMAT")
303 return ugettext('Day: %(start)s-%(end)s') % {
304 'start': date(self.start, date_format),
305 'end': date(self.end, date_format),
306 }
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
307
603eb3e @RockHoward Added convenience functions for periods and associated tests
RockHoward authored Dec 11, 2008
308 def prev_day(self):
309 return self.start - datetime.timedelta(days=1)
6fdcf9a @bartekgorny Added generic aliases to prev_*/next_* methods
bartekgorny authored Apr 10, 2009
310 prev = prev_day
603eb3e @RockHoward Added convenience functions for periods and associated tests
RockHoward authored Dec 11, 2008
311
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
312 def next_day(self):
313 return self.end
6fdcf9a @bartekgorny Added generic aliases to prev_*/next_* methods
bartekgorny authored Apr 10, 2009
314 next = next_day
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
315
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
316 def month(self):
317 return Month(self.events, self.start)
456ab93 @thauber Added recurring events, lots of backwards incompatable changes. Also …
thauber authored Nov 8, 2008
318
2c42865 @thauber fixed file structure
thauber authored Oct 8, 2008
319 def week(self):
320 return Week(self.events, self.start)
Something went wrong with that request. Please try again.