-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
#4036 Updated build list to include an alert state #5222
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,11 +2,13 @@ | |
|
||
"""Template tags for core app.""" | ||
|
||
import datetime | ||
import hashlib | ||
from urllib.parse import urlencode | ||
|
||
from django import template | ||
from django.conf import settings | ||
from django.utils import timezone | ||
from django.utils.encoding import force_bytes, force_text | ||
from django.utils.safestring import mark_safe | ||
|
||
|
@@ -112,3 +114,9 @@ def key(d, key_name): | |
@register.simple_tag | ||
def readthedocs_version(): | ||
return __version__ | ||
|
||
|
||
@register.simple_tag | ||
def get_past_time(mins): | ||
"""Subtracts provided minutes from current time.""" | ||
return timezone.now() - datetime.timedelta(minutes=int(mins)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We tend to avoid putting logic in templates like this. It should probably be a property defined on the models. A property method like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@agjohnson Thanks for your review. I have committed the changes you asked for. Please have a look and let me know if any further changes are required. |
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.
What about naming this as
minutes_ago
?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.
I was confused about what to call it. Thanks for the suggestion. I will change it as soon as possible.