Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Fix RecurringRule and OccurringRule model __str__ method #2166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Sep 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix RecurringRule and OccurringRule model __str__ method
  • Loading branch information
saadmk11 committed Oct 25, 2022
commit da3a02f7ff65e2c7e21e1190b5d8c2e529f6decf
12 changes: 9 additions & 3 deletions 12 events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@ 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)} - '
f'{date(self.dt_end, strftime)}'
)
JacobCoffee marked this conversation as resolved.
Show resolved Hide resolved

@property
def begin(self):
Expand Down Expand Up @@ -283,8 +286,11 @@ 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 '
f'{timedelta_nice_repr(self.freq_interval_as_timedelta)} since '
f'{date(self.dt_start, settings.SHORT_DATETIME_FORMAT)}'
)
JacobCoffee marked this conversation as resolved.
Show resolved Hide resolved

def to_rrule(self):
return rrule(
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.