Commit 0f2e904c authored by fred's avatar fred

add method to get natural weeks order

parent 489a6b93
......@@ -231,6 +231,20 @@ class Schedule(models.Model, WeekdayMixin):
return ugettext('2nd and 4th')
return None
def week_sort_key(self):
order = [
0b1111, # Every week
0b0001, # First week
0b0101, # First and third week
0b0010, # Second week
0b1010, # Second and fourth week
0b0100, # Third week
0b1000, # Fourth week
if self.weeks in order:
return order.index(self.weeks)
return -1
def get_duration(self):
if self.duration:
return self.duration
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment