Skip to content

Commit

Permalink
fix: RecurringRule and OccurringRule model __str__ method (#2166)
Browse files Browse the repository at this point in the history
* Fix `RecurringRule` and `OccurringRule` model `__str__` method

* Update events/models.py

* Update events/models.py

---------

Co-authored-by: Jacob Coffee <[email protected]>
  • Loading branch information
saadmk11 and JacobCoffee authored Sep 13, 2024
1 parent 24ce539 commit 30f3cb4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class OccurringRule(RuleMixin, models.Model):

def __str__(self):
strftime = settings.SHORT_DATETIME_FORMAT
return f'{self.event.title} {date(self.dt_start.strftime, strftime)} - {date(self.dt_end.strftime, strftime)}'
return f'{self.event.title} {date(self.dt_start, strftime)} - {date(self.dt_end, strftime)}'

@property
def begin(self):
Expand Down Expand Up @@ -283,8 +283,8 @@ class RecurringRule(RuleMixin, models.Model):
all_day = models.BooleanField(default=False)

def __str__(self):
strftime = settings.SHORT_DATETIME_FORMAT
return f'{self.event.title} every {timedelta_nice_repr(self.interval)} since {date(self.dt_start.strftime, strftime)}'
return (f'{self.event.title} every {timedelta_nice_repr(self.freq_interval_as_timedelta)} since '
f'{date(self.dt_start, settings.SHORT_DATETIME_FORMAT)}')

def to_rrule(self):
return rrule(
Expand Down

0 comments on commit 30f3cb4

Please sign in to comment.