-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #213 from domino14/improvement/196/spa
Improvement/196/spa
- Loading branch information
Showing
110 changed files
with
3,580 additions
and
3,525 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -125,3 +125,4 @@ def quiz_response(quiz): | |
'questionIndex': quiz.questionIndex, | ||
'id': quiz.id | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
CURRENT_VERSION = '0.9.1.0' | ||
CURRENT_VERSION = '0.10.0.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
from django.utils.translation import ugettext as _ | ||
from django.utils.translation import ungettext | ||
|
||
|
||
def pretty_date(now, time): | ||
""" | ||
Get a datetime object and return a | ||
pretty string like 'an hour ago', 'Yesterday', '3 months ago', | ||
'just now', etc | ||
""" | ||
|
||
diff = now - time | ||
second_diff = diff.seconds | ||
day_diff = diff.days | ||
|
||
if day_diff < 0: | ||
return '' | ||
|
||
if day_diff == 0: | ||
if second_diff < 10: | ||
return _("just now") | ||
if second_diff < 60: | ||
return _("%(seconds)s seconds ago") % {'seconds': second_diff} | ||
if second_diff < 120: | ||
return _("a minute ago") | ||
if second_diff < 3600: | ||
return _("%(minutes)s minutes ago") % {'minutes': second_diff / 60} | ||
if second_diff < 7200: | ||
return _("an hour ago") | ||
if second_diff < 86400: | ||
return _("%(hours)s hours ago") % {'hours': second_diff / 3600} | ||
if day_diff == 1: | ||
return _("Yesterday") | ||
if day_diff < 7: | ||
return _("%(day_diff)s days ago") % {'day_diff': day_diff} | ||
if day_diff < 31: | ||
return ungettext('%(week)d week ago', '%(week)d weeks ago', | ||
day_diff / 7) % {'week': day_diff / 7} | ||
if day_diff < 365: | ||
return ungettext('%(month)d month ago', '%(month)d months ago', | ||
day_diff / 30) % {'month': day_diff / 30} | ||
return ungettext('%(year)d year ago', '%(year)d years ago', | ||
day_diff / 365) % {'year': day_diff / 365} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -228,13 +228,14 @@ def tobool(val): | |
|
||
ACCOUNT_ACTIVATION_DAYS = 2 | ||
LOGIN_REDIRECT_URL = "/" | ||
# Used by social auth. | ||
LOGIN_ERROR_URL = '/login_error/' | ||
EMAIL_HOST = "smtp.mailgun.org" | ||
EMAIL_PORT = 587 | ||
EMAIL_HOST_USER = 'postmaster@aerolith.mailgun.org' | ||
EMAIL_HOST_USER = 'postmaster@mg.aerolith.org' | ||
EMAIL_HOST_PASSWORD = os.environ.get('EMAIL_PW') | ||
EMAIL_USE_TLS = True | ||
DEFAULT_FROM_EMAIL = '[email protected].org' | ||
DEFAULT_FROM_EMAIL = '[email protected].org' | ||
|
||
LOGIN_URL = "/accounts/login" | ||
|
||
|
@@ -249,7 +250,7 @@ def tobool(val): | |
|
||
LOGGING = { | ||
'version': 1, | ||
'disable_existing_loggers': True, | ||
'disable_existing_loggers': False, | ||
'filters': { | ||
'skip_suspicious_operations': { | ||
'()': 'django.utils.log.CallbackFilter', | ||
|
@@ -266,14 +267,10 @@ def tobool(val): | |
}, | ||
}, | ||
'handlers': { | ||
'null': { | ||
'level': 'DEBUG', | ||
'class': 'django.utils.log.NullHandler', | ||
}, | ||
'console': { | ||
'level': 'DEBUG', | ||
'class': 'logging.StreamHandler', | ||
'formatter': 'simple' | ||
'formatter': 'verbose' | ||
}, | ||
'mail_admins': { | ||
'level': 'ERROR', | ||
|
@@ -285,7 +282,12 @@ def tobool(val): | |
'loggers': { | ||
'django.db': { | ||
'handlers': ['console'], | ||
'level': 'INFO' | ||
'level': 'INFO', | ||
}, | ||
'social': { | ||
'handlers': ['console'], | ||
'level': 'ERROR', | ||
'propagate': False, | ||
}, | ||
'': { # catch-all | ||
'handlers': ['console', 'mail_admins'], | ||
|
@@ -303,21 +305,27 @@ def tobool(val): | |
'formatter': 'verbose', | ||
'backupCount': 10 | ||
} | ||
LOGGING['loggers']['django.db'] = { | ||
'handlers': ['log_file'], | ||
'level': 'INFO' | ||
} | ||
LOGGING['loggers']['django.request'] = { | ||
'handlers': ['mail_admins'], | ||
'level': 'ERROR', | ||
'propagate': True, | ||
} | ||
LOGGING['loggers'][''] = { | ||
'handlers': ['log_file', 'mail_admins'], | ||
'level': 'DEBUG', | ||
'propagate': True, | ||
|
||
LOGGING['loggers'] = { | ||
'django.db': { | ||
'handlers': ['log_file', 'mail_admins'], | ||
'level': 'INFO' | ||
}, | ||
'': { | ||
'handlers': ['log_file', 'mail_admins'], | ||
'level': 'DEBUG', | ||
} | ||
} | ||
LOGGING['disable_existing_loggers'] = False | ||
# We might swallow errors if we uncomment the following. The | ||
# issue is that the social exception middleware does a logger.error | ||
# even though it handles the exception, and this causes the mailer | ||
# to mail us. | ||
# LOGGING['loggers']['social'] = { | ||
# 'handlers': ['log_file'], | ||
# 'level': 'ERROR', | ||
# 'propagate': False, | ||
# } | ||
|
||
|
||
USE_MX = tobool(os.environ.get('USE_MX')) | ||
USE_GA = tobool(os.environ.get('USE_GA')) | ||
|
Oops, something went wrong.