-
Notifications
You must be signed in to change notification settings - Fork 601
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
Display Ongoing Events on the Events Page #2167
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just some nits
@@ -57,6 +57,26 @@ <h3 class="event-title"><a href="{{ object.get_absolute_url }}">{{ object.title| | |||
</ul> | |||
</div> | |||
|
|||
{% if events_ongoing %} | |||
<h3 class="widget-title">Ongoing Events</h3> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<h3 class="widget-title">Ongoing Events</h3> | |
<h3 class="widget-title">Happening Now<h3> |
I feel like this is "cooler" but just a nit :)
try: | ||
recurring_start = recurring_starts[0] | ||
except IndexError: | ||
pass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try: | |
recurring_start = recurring_starts[0] | |
except IndexError: | |
pass | |
with contextlib.suppress(IndexError): | |
recurring_start = recurring_starts[0] |
except OccurringRule.DoesNotExist: | ||
pass | ||
else: | ||
if occurring_rule and occurring_rule.dt_start < now and occurring_rule.dt_end > now: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if occurring_rule and occurring_rule.dt_start < now and occurring_rule.dt_end > now: | |
if occurring_rule and occurring_rule.dt_start < now < occurring_rule.dt_end: |
def ongoing_datetime(self, dt=None): | ||
if dt is None: | ||
dt = timezone.now() | ||
else: | ||
dt = convert_dt_to_aware(dt) | ||
return self.filter( | ||
(Q(occurring_rule__dt_start__lt=dt) & Q(occurring_rule__dt_end__gt=dt)) | ||
| (Q(recurring_rules__begin__lt=dt) & Q(recurring_rules__finish__gt=dt)) | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def ongoing_datetime(self, dt=None): | |
if dt is None: | |
dt = timezone.now() | |
else: | |
dt = convert_dt_to_aware(dt) | |
return self.filter( | |
(Q(occurring_rule__dt_start__lt=dt) & Q(occurring_rule__dt_end__gt=dt)) | |
| (Q(recurring_rules__begin__lt=dt) & Q(recurring_rules__finish__gt=dt)) | |
) | |
def ongoing_datetime(self, dt=None): | |
dt = timezone.now() if dt is None else convert_dt_to_aware(dt) | |
return self.filter( | |
(Q(occurring_rule__dt_start__lt=dt) & Q(occurring_rule__dt_end__gt=dt)) | |
| (Q(recurring_rules__begin__lt=dt) & Q(recurring_rules__finish__gt=dt)) | |
) |
Closing in favor of #2556, I wasnt able to get this to work. I will probably yank some things from this though so ill make sure to give commit credits |
closes #2138