diff --git a/.gitignore b/.gitignore index 79e036f2..4aba05bf 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,8 @@ backups/ *.log *.log.* -# Python runtime and setup +# Python runtime, setup and testing +.mypy_cache/ __pycache__ env/ venv/ diff --git a/lowfat/context.py b/lowfat/context.py index 10b4f99e..7bf5fe44 100644 --- a/lowfat/context.py +++ b/lowfat/context.py @@ -1,27 +1,32 @@ -"""Context for template""" +"""Context processors to add data to template context.""" from django.contrib.sites.models import Site from django.utils import timezone from constance import config + def site(request): # pylint: disable=unused-argument + # type: (...) -> dict """Return the site.""" return { 'site': Site.objects.get_current() } + def organisation(request): # pylint: disable=unused-argument + # type: (...) -> dict """Return the organisation.""" return { 'organisation_name': config.ORGANISATION_NAME, 'organisation_website': config.ORGANISATION_WEBSITE, } + def maintenance(request): # pylint: disable=unused-argument - """Return true if default maintancance time.""" + # type: (...) -> dict + """Return whether current time is within scheduled maintenance period.""" now = timezone.now() - if now.weekday() == config.MAINTENANCE_DAY and now.hour == config.MAINTENANCE_HOUR: - return {"is_maintenance_time": True} - - return {"is_maintenance_time": False} + return { + 'is_maintenance_time': now.weekday() == config.MAINTENANCE_DAY and now.hour == config.MAINTENANCE_HOUR + } diff --git a/lowfat/settings.py b/lowfat/settings.py index c3b3affa..51a5f19f 100644 --- a/lowfat/settings.py +++ b/lowfat/settings.py @@ -15,7 +15,7 @@ URL_SRC = "https://github.com/softwaresaved/lowfat" -VERSION = "1.18.1" +VERSION = "1.18.2" SETTINGS_EXPORT = [ 'URL_SRC', diff --git a/requirements.txt b/requirements.txt index fab49184..1879bf77 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ django<2.0 django-constance[database] django-countries django-tagulous -django-crispy-forms +django-crispy-forms<1.9 django-datetime-widget django-dbbackup>=3.2.0 django-extensions @@ -19,7 +19,8 @@ pylint>=1.8.2 pylint-django>=0.9.0 pypdf2 python-gnupg -social-auth-app-django +social-auth-app-django~=3.1.0 +social-auth-core~=3.3.1 # Report jupyter ipython