diff --git a/.flake8 b/.flake8 index ab653c25..4cdc9c07 100644 --- a/.flake8 +++ b/.flake8 @@ -1,6 +1,5 @@ [flake8] per-file-ignores = - volunteer_planner/settings/*.py: F403, F405, - volunteer_planner/settings/__init__.py: F403, + volunteer_planner/settings/*.py: F401, F403, F405, max-line-length = 88 diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 3ea81909..a70d81d1 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -101,9 +101,6 @@ jobs: uses: actions/checkout@v2 - name: flake8 Lint uses: py-actions/flake8@v2 - continue-on-error: true - - name: Succeed until flake8 is enforced - run: exit 0 pytest: name: Unit Tests diff --git a/accounts/admin.py b/accounts/admin.py index 30d64945..fec0a776 100644 --- a/accounts/admin.py +++ b/accounts/admin.py @@ -97,7 +97,7 @@ def _session_data(self, obj): try: user = User.objects.get(id=decoded.get(key)) _session_data += " (" + user.username + ")" - except Exception as e: + except Exception: pass _session_data += "
" return format_html(_session_data) diff --git a/accounts/apps.py b/accounts/apps.py index 9fd5b1e7..5a38560c 100644 --- a/accounts/apps.py +++ b/accounts/apps.py @@ -8,7 +8,7 @@ class AccountsConfig(AppConfig): verbose_name = _("Accounts") def ready(self): - import accounts.signals + from . import signals # noqa class RegistrationConfig(AppConfig): diff --git a/accounts/forms.py b/accounts/forms.py index dca032da..a9db15b0 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -1,6 +1,6 @@ from django import forms -from registration.forms import RegistrationFormUniqueEmail from django.utils.text import gettext_lazy as _ +from registration.forms import RegistrationFormUniqueEmail class RegistrationForm(RegistrationFormUniqueEmail): diff --git a/accounts/management/commands/clean_expired.py b/accounts/management/commands/clean_expired.py index 62d87749..a68f93fd 100644 --- a/accounts/management/commands/clean_expired.py +++ b/accounts/management/commands/clean_expired.py @@ -1,9 +1,8 @@ # coding=utf-8 -from django.conf import settings -from django.core.management.base import BaseCommand - from datetime import date, timedelta +from django.conf import settings +from django.core.management.base import BaseCommand from registration.models import RegistrationProfile diff --git a/accounts/migrations/0001_initial.py b/accounts/migrations/0001_initial.py index dd32983c..de8145da 100644 --- a/accounts/migrations/0001_initial.py +++ b/accounts/migrations/0001_initial.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations from django.conf import settings +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/accounts/urls.py b/accounts/urls.py index d5df5cce..43486d69 100644 --- a/accounts/urls.py +++ b/accounts/urls.py @@ -2,14 +2,13 @@ from django.urls import re_path - from .views import ( - user_account_detail, - AccountUpdateView, - AccountDeleteView, account_delete_final, + AccountDeleteView, + AccountUpdateView, shift_list_active, shift_list_done, + user_account_detail, ) urlpatterns = [ diff --git a/accounts/views.py b/accounts/views.py index 4a1d6f04..32039d03 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -1,21 +1,19 @@ import random import string +from datetime import date, datetime, timedelta from django.contrib.admin.models import DELETION, LogEntry -from django.contrib.auth import logout +from django.contrib.auth import logout, models +from django.contrib.auth.decorators import login_required from django.contrib.contenttypes.models import ContentType from django.db import transaction from django.shortcuts import render -from django.contrib.auth.decorators import login_required -from django.views.generic.edit import UpdateView from django.urls import reverse_lazy -from django.contrib.auth import models - -from datetime import date, datetime, timedelta +from django.views.generic.edit import UpdateView -from volunteer_planner.utils import LoginRequiredMixin -from scheduler.models import ShiftHelper from accounts.models import UserAccount +from scheduler.models import ShiftHelper +from volunteer_planner.utils import LoginRequiredMixin @login_required() diff --git a/blueprint/migrations/0001_initial.py b/blueprint/migrations/0001_initial.py index 2c7a6893..26faaaa3 100644 --- a/blueprint/migrations/0001_initial.py +++ b/blueprint/migrations/0001_initial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/blueprint/migrations/0002_needblueprint_slots.py b/blueprint/migrations/0002_needblueprint_slots.py index a1d5c8e9..8deef642 100644 --- a/blueprint/migrations/0002_needblueprint_slots.py +++ b/blueprint/migrations/0002_needblueprint_slots.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/blueprint/migrations/0003_auto_20151003_2033.py b/blueprint/migrations/0003_auto_20151003_2033.py index 1ed8a2cf..000fb83d 100644 --- a/blueprint/migrations/0003_auto_20151003_2033.py +++ b/blueprint/migrations/0003_auto_20151003_2033.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/blueprint/migrations/0003_auto_20151006_1341.py b/blueprint/migrations/0003_auto_20151006_1341.py index 0b40f017..d3cae794 100644 --- a/blueprint/migrations/0003_auto_20151006_1341.py +++ b/blueprint/migrations/0003_auto_20151006_1341.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/blueprint/migrations/0004_merge.py b/blueprint/migrations/0004_merge.py index afc3489d..2d5f3f17 100644 --- a/blueprint/migrations/0004_merge.py +++ b/blueprint/migrations/0004_merge.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations class Migration(migrations.Migration): diff --git a/blueprint/migrations/0005_demolish_blueprints.py b/blueprint/migrations/0005_demolish_blueprints.py index e0caeef1..ab12c1a6 100644 --- a/blueprint/migrations/0005_demolish_blueprints.py +++ b/blueprint/migrations/0005_demolish_blueprints.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations class Migration(migrations.Migration): diff --git a/common/management/commands/check_db_connection.py b/common/management/commands/check_db_connection.py index 51af7c52..0f7d3e7c 100644 --- a/common/management/commands/check_db_connection.py +++ b/common/management/commands/check_db_connection.py @@ -40,7 +40,7 @@ def handle(self, *args, **options): db_conn = connections["default"] for i in range(0, options["count"]): try: - c = db_conn.cursor() + db_conn.cursor() success = True break except OperationalError as e: diff --git a/common/models.py b/common/models.py index 6ec9881a..a309ba4a 100644 --- a/common/models.py +++ b/common/models.py @@ -1,4 +1,3 @@ # coding=utf-8 -from django.db import models # Create your models here. diff --git a/common/static_file_compressor.py b/common/static_file_compressor.py index 86c85402..c6f4cf53 100644 --- a/common/static_file_compressor.py +++ b/common/static_file_compressor.py @@ -3,9 +3,9 @@ import io import re import shutil +from importlib import import_module from django.contrib.staticfiles.storage import StaticFilesStorage -from importlib import import_module class CompressedStaticFilesStorage(StaticFilesStorage): @@ -15,7 +15,7 @@ class CompressedStaticFilesStorage(StaticFilesStorage): def __init__(self, location=None, base_url=None, *args, **kwargs): super().__init__(location, base_url, *args, **kwargs) for ext in self.EXTENSIONS: - self.EXT_LOOKUP[ext] = re.compile(".*\.{}\Z".format(ext)) + self.EXT_LOOKUP[ext] = re.compile(r".*\.{}\Z".format(ext)) def post_process(self, paths, dry_run=False, **kwargs): processing_files = [] @@ -36,9 +36,10 @@ def _post_process(self, name, path, ext, dry_run): func = getattr(self, func_name) if func: processed = func(path) - except AttributeError as e: + except AttributeError: processed = False - except io.UnsupportedOperation as e: + except io.UnsupportedOperation: + # raise explicitly raise return name, path, processed @@ -70,7 +71,7 @@ def _generic_minify(path, module, func): __class__._gzip(path) return True - except: + except Exception: return False @staticmethod @@ -79,5 +80,5 @@ def _gzip(path): with open(path, "rb") as f_in: with gzip.open("{}.gz".format(path), "wb") as f_out: shutil.copyfileobj(f_in, f_out) - except: + except Exception: pass diff --git a/common/templatetags/volunteer_stats.py b/common/templatetags/volunteer_stats.py index f9991acd..72bcbfeb 100644 --- a/common/templatetags/volunteer_stats.py +++ b/common/templatetags/volunteer_stats.py @@ -32,7 +32,9 @@ def get_volunteer_number(): @register.simple_tag def get_volunteer_deleted_number(): """ - Returns the number of deleted volunteer accounts (accounts are inactive and anonymized) + Returns the number of deleted volunteer accounts. + + Accounts are inactive and anonymized. """ return User.objects.filter(is_active=False).count() @@ -42,7 +44,8 @@ def get_volunteer_hours(): """ Returns the number of total volunteer hours worked. """ - finished_shifts = Shift.objects.filter(starting_time__lte=timezone.now()).annotate( + now = timezone.now() + finished_shifts = Shift.objects.filter(starting_time__lte=now).annotate( slots_done=Count("helpers") ) delta = timedelta() diff --git a/common/views.py b/common/views.py index 8f5fbe68..9f0e7b1c 100644 --- a/common/views.py +++ b/common/views.py @@ -1,4 +1,3 @@ # coding=utf-8 -from django.shortcuts import render # Create your views here. diff --git a/content/admin.py b/content/admin.py index 6477f25e..37954d1a 100644 --- a/content/admin.py +++ b/content/admin.py @@ -1,13 +1,12 @@ # coding: utf-8 from django.conf import settings - from django.contrib import admin from django.contrib.flatpages.admin import FlatPageAdmin from django.contrib.flatpages.models import FlatPage from django.utils.html import format_html from django.utils.translation import gettext_lazy as _ -from . import models, forms +from . import forms, models class FlatPageStyleInline(admin.StackedInline): diff --git a/content/forms.py b/content/forms.py index 34db844d..a86eed8f 100644 --- a/content/forms.py +++ b/content/forms.py @@ -1,7 +1,7 @@ # coding: utf-8 from ckeditor.widgets import CKEditorWidget -from django.contrib.flatpages.forms import FlatpageForm from django import forms +from django.contrib.flatpages.forms import FlatpageForm from content.models import FlatPageTranslation diff --git a/content/migrations/0001_initial.py b/content/migrations/0001_initial.py index 209e7157..924dd9e9 100644 --- a/content/migrations/0001_initial.py +++ b/content/migrations/0001_initial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/content/migrations/0002_add_greek_language.py b/content/migrations/0002_add_greek_language.py index 3a7e9ea2..eaf904cf 100644 --- a/content/migrations/0002_add_greek_language.py +++ b/content/migrations/0002_add_greek_language.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/content/models.py b/content/models.py index 206e45e0..e0ff6e94 100644 --- a/content/models.py +++ b/content/models.py @@ -1,9 +1,9 @@ # coding: utf-8 -from django.db import models -from django.utils.translation import gettext_lazy as _ from django.conf import settings from django.contrib.flatpages.models import FlatPage +from django.db import models +from django.utils.translation import gettext_lazy as _ class FlatPageExtraStyle(models.Model): diff --git a/content/tests.py b/content/tests.py index 7ce503c2..a39b155a 100644 --- a/content/tests.py +++ b/content/tests.py @@ -1,3 +1 @@ -from django.test import TestCase - # Create your tests here. diff --git a/content/views.py b/content/views.py index 48c644d0..cbbf7392 100644 --- a/content/views.py +++ b/content/views.py @@ -2,11 +2,10 @@ from django.contrib.flatpages.models import FlatPage from django.contrib.flatpages.views import render_flatpage from django.contrib.sites.shortcuts import get_current_site -from django.http import Http404, HttpResponse, HttpResponsePermanentRedirect +from django.http import Http404, HttpResponsePermanentRedirect from django.shortcuts import get_object_or_404 -from django.template import loader -from django.utils.safestring import mark_safe from django.views.decorators.csrf import csrf_protect + from content.models import FlatPageTranslation DEFAULT_TEMPLATE = "flatpages/default.html" diff --git a/locale/ar/LC_MESSAGES/django.po b/locale/ar/LC_MESSAGES/django.po index 06c6f685..b77afb2d 100644 --- a/locale/ar/LC_MESSAGES/django.po +++ b/locale/ar/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-21 16:52+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2022-03-15 17:56+0000\n" "Last-Translator: Christoph Meißner\n" "Language-Team: Arabic (http://www.transifex.com/coders4help/volunteer-planner/language/ar/)\n" @@ -687,11 +687,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/bg/LC_MESSAGES/django.po b/locale/bg/LC_MESSAGES/django.po index 90b9684e..b37918fc 100644 --- a/locale/bg/LC_MESSAGES/django.po +++ b/locale/bg/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-22 10:26+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2022-03-15 17:56+0000\n" "Last-Translator: Christoph Meißner\n" "Language-Team: Bulgarian (http://www.transifex.com/coders4help/volunteer-planner/language/bg/)\n" @@ -683,11 +683,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/cs/LC_MESSAGES/django.po b/locale/cs/LC_MESSAGES/django.po index ef972cf2..0b6c0d3e 100644 --- a/locale/cs/LC_MESSAGES/django.po +++ b/locale/cs/LC_MESSAGES/django.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-23 00:36+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2022-03-15 17:56+0000\n" "Last-Translator: Christoph Meißner\n" "Language-Team: Czech (http://www.transifex.com/coders4help/volunteer-planner/language/cs/)\n" @@ -700,11 +700,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/da/LC_MESSAGES/django.po b/locale/da/LC_MESSAGES/django.po index 91af9c88..0473868b 100644 --- a/locale/da/LC_MESSAGES/django.po +++ b/locale/da/LC_MESSAGES/django.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-21 18:15+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2017-09-22 15:35+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Danish (http://www.transifex.com/coders4help/volunteer-planner/language/da/)\n" @@ -684,11 +684,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/de/LC_MESSAGES/django.po b/locale/de/LC_MESSAGES/django.po index 534eabc1..3f715171 100644 --- a/locale/de/LC_MESSAGES/django.po +++ b/locale/de/LC_MESSAGES/django.po @@ -19,7 +19,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-23 00:36+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2016-11-21 18:24+0000\n" "Last-Translator: Sönke Klinger \n" "Language-Team: German (http://www.transifex.com/coders4help/volunteer-planner/language/de/)\n" @@ -712,12 +712,8 @@ msgid "Facilities do not match." msgstr "Einrichtungen stimmen nicht überein." #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "\"{task.name}\" gehört zur Einrichtung \"{task.facility.name}\", die Schicht ist aber für \"{facility.name}\" angelegt." - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." -msgstr "\"{workplace.name}\" gehört zur Einrichtung \"{workplace.facility.name}\", die Schicht ist aber für \"{facility.name}\" angelegt." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." +msgstr "\"{object.name}\" gehört zur Einrichtung \"{object.facility.name}\", die Schicht ist aber für \"{facility.name}\" angelegt." msgid "No start time given." msgstr "Keine Startzeit angegeben." diff --git a/locale/el/LC_MESSAGES/django.po b/locale/el/LC_MESSAGES/django.po index 4a1512dd..490e96f8 100644 --- a/locale/el/LC_MESSAGES/django.po +++ b/locale/el/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-23 00:36+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Greek (http://www.transifex.com/coders4help/volunteer-planner/language/el/)\n" @@ -715,11 +715,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po index c73a3bb2..7b0bdff3 100644 --- a/locale/en/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -2,7 +2,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-23 00:36+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2015-10-04 21:53+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: English (http://www.transifex.com/coders4help/volunteer-planner/language/en/)\n" @@ -680,11 +680,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/es/LC_MESSAGES/django.po b/locale/es/LC_MESSAGES/django.po index 17c3b6e8..d7ea2d15 100644 --- a/locale/es/LC_MESSAGES/django.po +++ b/locale/es/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-23 00:36+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2016-04-13 17:27+0000\n" "Last-Translator: Antonio Mireles \n" "Language-Team: Spanish (http://www.transifex.com/coders4help/volunteer-planner/language/es/)\n" @@ -706,11 +706,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/es_MX/LC_MESSAGES/django.po b/locale/es_MX/LC_MESSAGES/django.po index cb152a08..d51212cb 100644 --- a/locale/es_MX/LC_MESSAGES/django.po +++ b/locale/es_MX/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-21 18:15+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2015-09-24 12:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Spanish (Mexico) (http://www.transifex.com/coders4help/volunteer-planner/language/es_MX/)\n" @@ -683,11 +683,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/fa/LC_MESSAGES/django.po b/locale/fa/LC_MESSAGES/django.po index d7442c01..dd492624 100644 --- a/locale/fa/LC_MESSAGES/django.po +++ b/locale/fa/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-22 09:49+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Persian (http://www.transifex.com/coders4help/volunteer-planner/language/fa/)\n" @@ -683,11 +683,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/fr/LC_MESSAGES/django.po b/locale/fr/LC_MESSAGES/django.po index fea09eb0..79b54ac2 100644 --- a/locale/fr/LC_MESSAGES/django.po +++ b/locale/fr/LC_MESSAGES/django.po @@ -10,7 +10,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-23 00:36+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2016-12-08 20:50+0000\n" "Last-Translator: Dolfeus \n" "Language-Team: French (http://www.transifex.com/coders4help/volunteer-planner/language/fr/)\n" @@ -704,11 +704,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/hr/LC_MESSAGES/django.po b/locale/hr/LC_MESSAGES/django.po index 6af6a862..f3f86696 100644 --- a/locale/hr/LC_MESSAGES/django.po +++ b/locale/hr/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-22 09:49+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Croatian (http://www.transifex.com/coders4help/volunteer-planner/language/hr/)\n" @@ -683,11 +683,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/hu/LC_MESSAGES/django.po b/locale/hu/LC_MESSAGES/django.po index e798e150..2f8aa580 100644 --- a/locale/hu/LC_MESSAGES/django.po +++ b/locale/hu/LC_MESSAGES/django.po @@ -14,7 +14,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-23 00:36+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Hungarian (http://www.transifex.com/coders4help/volunteer-planner/language/hu/)\n" @@ -693,11 +693,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/hy/LC_MESSAGES/django.po b/locale/hy/LC_MESSAGES/django.po index 12e6211c..b2a74449 100644 --- a/locale/hy/LC_MESSAGES/django.po +++ b/locale/hy/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-22 09:49+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2015-09-24 12:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Armenian (http://www.transifex.com/coders4help/volunteer-planner/language/hy/)\n" @@ -683,11 +683,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/it/LC_MESSAGES/django.po b/locale/it/LC_MESSAGES/django.po index ecb6d63d..3f3532f0 100644 --- a/locale/it/LC_MESSAGES/django.po +++ b/locale/it/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-22 09:49+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Italian (http://www.transifex.com/coders4help/volunteer-planner/language/it/)\n" @@ -683,11 +683,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/nl/LC_MESSAGES/django.po b/locale/nl/LC_MESSAGES/django.po index 157a29b0..1cf82bae 100644 --- a/locale/nl/LC_MESSAGES/django.po +++ b/locale/nl/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-22 09:49+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Dutch (http://www.transifex.com/coders4help/volunteer-planner/language/nl/)\n" @@ -683,11 +683,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/no/LC_MESSAGES/django.po b/locale/no/LC_MESSAGES/django.po index 5f7c7c0d..42a32165 100644 --- a/locale/no/LC_MESSAGES/django.po +++ b/locale/no/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-22 09:49+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Norwegian (http://www.transifex.com/coders4help/volunteer-planner/language/no/)\n" @@ -683,11 +683,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/pl/LC_MESSAGES/django.po b/locale/pl/LC_MESSAGES/django.po index a7787b85..60e59339 100644 --- a/locale/pl/LC_MESSAGES/django.po +++ b/locale/pl/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-01-29 09:22+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2017-09-22 15:29+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Polish (http://www.transifex.com/coders4help/volunteer-planner/language/pl/)\n" @@ -687,11 +687,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/pt/LC_MESSAGES/django.po b/locale/pt/LC_MESSAGES/django.po index 3864ecca..f2218a5d 100644 --- a/locale/pt/LC_MESSAGES/django.po +++ b/locale/pt/LC_MESSAGES/django.po @@ -9,7 +9,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-23 00:36+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Portuguese (http://www.transifex.com/coders4help/volunteer-planner/language/pt/)\n" @@ -688,11 +688,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/pt_BR/LC_MESSAGES/django.po b/locale/pt_BR/LC_MESSAGES/django.po index 30f0423b..d5ac6387 100644 --- a/locale/pt_BR/LC_MESSAGES/django.po +++ b/locale/pt_BR/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-22 09:49+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2015-09-24 12:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Portuguese (Brazil) (http://www.transifex.com/coders4help/volunteer-planner/language/pt_BR/)\n" @@ -683,11 +683,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/ro/LC_MESSAGES/django.po b/locale/ro/LC_MESSAGES/django.po index e41f8032..111f5f6f 100644 --- a/locale/ro/LC_MESSAGES/django.po +++ b/locale/ro/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-22 09:49+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Romanian (http://www.transifex.com/coders4help/volunteer-planner/language/ro/)\n" @@ -683,11 +683,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/ru/LC_MESSAGES/django.po b/locale/ru/LC_MESSAGES/django.po index c90ecb12..a411c2c4 100644 --- a/locale/ru/LC_MESSAGES/django.po +++ b/locale/ru/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2016-01-29 09:22+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2022-03-10 13:42+0000\n" "Last-Translator: Anna Dunn\n" "Language-Team: Russian (http://www.transifex.com/coders4help/volunteer-planner/language/ru/)\n" @@ -707,11 +707,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/sk/LC_MESSAGES/django.po b/locale/sk/LC_MESSAGES/django.po index 13189ba4..3aa11b9d 100644 --- a/locale/sk/LC_MESSAGES/django.po +++ b/locale/sk/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-22 09:49+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Slovak (http://www.transifex.com/coders4help/volunteer-planner/language/sk/)\n" @@ -683,11 +683,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/sl/LC_MESSAGES/django.po b/locale/sl/LC_MESSAGES/django.po index 88a9775e..44471158 100644 --- a/locale/sl/LC_MESSAGES/django.po +++ b/locale/sl/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-22 09:49+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Slovenian (http://www.transifex.com/coders4help/volunteer-planner/language/sl/)\n" @@ -683,11 +683,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/sq/LC_MESSAGES/django.po b/locale/sq/LC_MESSAGES/django.po index 81a4b6cc..ff9f1e21 100644 --- a/locale/sq/LC_MESSAGES/django.po +++ b/locale/sq/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-22 09:49+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Albanian (http://www.transifex.com/coders4help/volunteer-planner/language/sq/)\n" @@ -683,11 +683,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/sr_RS/LC_MESSAGES/django.po b/locale/sr_RS/LC_MESSAGES/django.po index 840d8ffb..1457fb7d 100644 --- a/locale/sr_RS/LC_MESSAGES/django.po +++ b/locale/sr_RS/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-22 09:49+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Serbian (Serbia) (http://www.transifex.com/coders4help/volunteer-planner/language/sr_RS/)\n" @@ -683,11 +683,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/sv/LC_MESSAGES/django.po b/locale/sv/LC_MESSAGES/django.po index 11ac3b4a..27041b89 100644 --- a/locale/sv/LC_MESSAGES/django.po +++ b/locale/sv/LC_MESSAGES/django.po @@ -11,7 +11,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-23 00:36+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Swedish (http://www.transifex.com/coders4help/volunteer-planner/language/sv/)\n" @@ -711,11 +711,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/tr/LC_MESSAGES/django.po b/locale/tr/LC_MESSAGES/django.po index 4a4077c0..2222e46d 100644 --- a/locale/tr/LC_MESSAGES/django.po +++ b/locale/tr/LC_MESSAGES/django.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-23 00:36+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2016-01-29 08:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Turkish (http://www.transifex.com/coders4help/volunteer-planner/language/tr/)\n" @@ -684,11 +684,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/tr_TR/LC_MESSAGES/django.po b/locale/tr_TR/LC_MESSAGES/django.po index ead2795e..2a096526 100644 --- a/locale/tr_TR/LC_MESSAGES/django.po +++ b/locale/tr_TR/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-22 09:49+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2015-09-24 12:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Turkish (Turkey) (http://www.transifex.com/coders4help/volunteer-planner/language/tr_TR/)\n" @@ -683,11 +683,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/uk/LC_MESSAGES/django.po b/locale/uk/LC_MESSAGES/django.po index a45bb06b..5595ed44 100644 --- a/locale/uk/LC_MESSAGES/django.po +++ b/locale/uk/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-22 09:49+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2015-09-24 12:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Ukrainian (http://www.transifex.com/coders4help/volunteer-planner/language/uk/)\n" @@ -683,11 +683,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/locale/zh_CN/LC_MESSAGES/django.po b/locale/zh_CN/LC_MESSAGES/django.po index ee86850e..d25b5967 100644 --- a/locale/zh_CN/LC_MESSAGES/django.po +++ b/locale/zh_CN/LC_MESSAGES/django.po @@ -4,7 +4,7 @@ msgid "" msgstr "" "Project-Id-Version: volunteer-planner.org\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-03-22 09:49+0100\n" +"POT-Creation-Date: 2022-03-25 11:54+0100\n" "PO-Revision-Date: 2015-09-24 12:23+0000\n" "Last-Translator: Dorian Cantzen \n" "Language-Team: Chinese (China) (http://www.transifex.com/coders4help/volunteer-planner/language/zh_CN/)\n" @@ -683,11 +683,7 @@ msgid "Facilities do not match." msgstr "" #, python-brace-format -msgid "\"{task.name}\" belongs to facility \"{task.facility.name}\", but shift takes place at \"{facility.name}\"." -msgstr "" - -#, python-brace-format -msgid "\"{workplace.name}\" is at \"{workplace.facility.name}\" but shift takes place at \"{facility.name}\"." +msgid "\"{object.name}\" belongs to facility \"{object.facility.name}\", but shift takes place at \"{facility.name}\"." msgstr "" msgid "No start time given." diff --git a/news/admin.py b/news/admin.py index 9119fe89..1b65172e 100755 --- a/news/admin.py +++ b/news/admin.py @@ -1,11 +1,11 @@ # coding: utf-8 -from django.contrib import admin -from django import forms from ckeditor.widgets import CKEditorWidget +from django import forms +from django.contrib import admin +from organizations.admin import MembershipFieldListFilter, MembershipFilteredAdmin from . import models -from organizations.admin import MembershipFilteredAdmin, MembershipFieldListFilter class NewsAdminForm(forms.ModelForm): diff --git a/news/migrations/0001_initial.py b/news/migrations/0001_initial.py index 0825c69d..1556e168 100644 --- a/news/migrations/0001_initial.py +++ b/news/migrations/0001_initial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/news/migrations/0002_rename_news_model.py b/news/migrations/0002_rename_news_model.py index e71ea814..a1b3bb49 100644 --- a/news/migrations/0002_rename_news_model.py +++ b/news/migrations/0002_rename_news_model.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/news/migrations/0003_cascade_deletion.py b/news/migrations/0003_cascade_deletion.py index 69773919..1f001c7e 100644 --- a/news/migrations/0003_cascade_deletion.py +++ b/news/migrations/0003_cascade_deletion.py @@ -1,7 +1,7 @@ # Generated by Django 2.0.5 on 2019-07-18 22:59 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/news/models.py b/news/models.py index 5d9f14da..1071f643 100755 --- a/news/models.py +++ b/news/models.py @@ -1,8 +1,8 @@ # coding: utf-8 from django.db import models -from django.utils.translation import gettext_lazy as _ from django.template.defaultfilters import slugify +from django.utils.translation import gettext_lazy as _ class NewsEntry(models.Model): diff --git a/news/tests.py b/news/tests.py index 7ce503c2..a39b155a 100755 --- a/news/tests.py +++ b/news/tests.py @@ -1,3 +1 @@ -from django.test import TestCase - # Create your tests here. diff --git a/news/views.py b/news/views.py index 91ea44a2..60f00ef0 100755 --- a/news/views.py +++ b/news/views.py @@ -1,3 +1 @@ -from django.shortcuts import render - # Create your views here. diff --git a/non_logged_in_area/admin.py b/non_logged_in_area/admin.py index 970f994f..d756f454 100644 --- a/non_logged_in_area/admin.py +++ b/non_logged_in_area/admin.py @@ -1,4 +1,3 @@ # coding=utf-8 -from django.contrib import admin # Register your models here. diff --git a/non_logged_in_area/models.py b/non_logged_in_area/models.py index 6ec9881a..a309ba4a 100644 --- a/non_logged_in_area/models.py +++ b/non_logged_in_area/models.py @@ -1,4 +1,3 @@ # coding=utf-8 -from django.db import models # Create your models here. diff --git a/notifications/migrations/0001_initial.py b/notifications/migrations/0001_initial.py index 8891e609..1a4d3c90 100644 --- a/notifications/migrations/0001_initial.py +++ b/notifications/migrations/0001_initial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/notifications/migrations/0002_auto_20150823_1658.py b/notifications/migrations/0002_auto_20150823_1658.py index 3dea99ae..05bda273 100644 --- a/notifications/migrations/0002_auto_20150823_1658.py +++ b/notifications/migrations/0002_auto_20150823_1658.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/notifications/migrations/0003_auto_20150912_2049.py b/notifications/migrations/0003_auto_20150912_2049.py index 0a3bd37a..9d6b6a1c 100644 --- a/notifications/migrations/0003_auto_20150912_2049.py +++ b/notifications/migrations/0003_auto_20150912_2049.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/notifications/migrations/0004_auto_20151003_2033.py b/notifications/migrations/0004_auto_20151003_2033.py index 1fa68d79..5feec263 100644 --- a/notifications/migrations/0004_auto_20151003_2033.py +++ b/notifications/migrations/0004_auto_20151003_2033.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/notifications/migrations/0005_remove_notification_model.py b/notifications/migrations/0005_remove_notification_model.py index 6ee47adc..8f18a6fb 100644 --- a/notifications/migrations/0005_remove_notification_model.py +++ b/notifications/migrations/0005_remove_notification_model.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations class Migration(migrations.Migration): diff --git a/organizations/admin.py b/organizations/admin.py index 26f88016..6f441ad1 100644 --- a/organizations/admin.py +++ b/organizations/admin.py @@ -1,19 +1,18 @@ # -*- coding: utf-8 -*- -from collections import defaultdict import itertools +from collections import defaultdict from operator import itemgetter from ckeditor.widgets import CKEditorWidget from django.contrib import admin -from django.db.models import Q, Count +from django.db.models import Count, Q from django.template.defaultfilters import striptags from django.utils.encoding import smart_str as smart_text - from django.utils.translation import gettext_lazy as _ -from . import models -from scheduler import models as shiftmodels from organizations.models import Membership +from scheduler import models as shiftmodels +from . import models DEFAULT_FILTER_ROLES = (models.Membership.Roles.ADMIN, models.Membership.Roles.MANAGER) diff --git a/organizations/managers.py b/organizations/managers.py index 1a36b403..8d1dc058 100644 --- a/organizations/managers.py +++ b/organizations/managers.py @@ -1,4 +1,4 @@ -from django.db.models import Q, Count, Manager +from django.db.models import Count, Manager, Q from django.utils import timezone diff --git a/organizations/migrations/0001_initial.py b/organizations/migrations/0001_initial.py index 91e6a121..f71ad3af 100644 --- a/organizations/migrations/0001_initial.py +++ b/organizations/migrations/0001_initial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/organizations/migrations/0003_workplace.py b/organizations/migrations/0003_workplace.py index 20caeae6..f10c0103 100644 --- a/organizations/migrations/0003_workplace.py +++ b/organizations/migrations/0003_workplace.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/organizations/migrations/0004_add_tasks.py b/organizations/migrations/0004_add_tasks.py index 727cdcb9..02296955 100644 --- a/organizations/migrations/0004_add_tasks.py +++ b/organizations/migrations/0004_add_tasks.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/organizations/migrations/0005_auto_20151021_1153.py b/organizations/migrations/0005_auto_20151021_1153.py index e36c08a6..5495a880 100644 --- a/organizations/migrations/0005_auto_20151021_1153.py +++ b/organizations/migrations/0005_auto_20151021_1153.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/organizations/migrations/0006_auto_20151022_1445.py b/organizations/migrations/0006_auto_20151022_1445.py index 34ceae27..bbd5de2e 100644 --- a/organizations/migrations/0006_auto_20151022_1445.py +++ b/organizations/migrations/0006_auto_20151022_1445.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/organizations/migrations/0007_auto_20151023_2129.py b/organizations/migrations/0007_auto_20151023_2129.py index 1eee464d..a4583485 100644 --- a/organizations/migrations/0007_auto_20151023_2129.py +++ b/organizations/migrations/0007_auto_20151023_2129.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/organizations/migrations/0008_add_slug_field.py b/organizations/migrations/0008_add_slug_field.py index e8f465e6..476407e1 100644 --- a/organizations/migrations/0008_add_slug_field.py +++ b/organizations/migrations/0008_add_slug_field.py @@ -3,8 +3,9 @@ import sys -from django.db import models, migrations +from django.db import migrations, models from django.utils.text import slugify + from common.migrations import skip diff --git a/organizations/migrations/0009_membership_status.py b/organizations/migrations/0009_membership_status.py index 5687ad8b..c1f4feec 100644 --- a/organizations/migrations/0009_membership_status.py +++ b/organizations/migrations/0009_membership_status.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models from common.migrations import skip diff --git a/organizations/migrations/0010_membership_join_mode.py b/organizations/migrations/0010_membership_join_mode.py index baad98ce..e5859c6f 100644 --- a/organizations/migrations/0010_membership_join_mode.py +++ b/organizations/migrations/0010_membership_join_mode.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models from common.migrations import skip from organizations.models import Membership diff --git a/organizations/migrations/0011_add_timeline_view_option.py b/organizations/migrations/0011_add_timeline_view_option.py index 00bef00d..9132c3e4 100644 --- a/organizations/migrations/0011_add_timeline_view_option.py +++ b/organizations/migrations/0011_add_timeline_view_option.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/organizations/migrations/0012_cascade_deletion.py b/organizations/migrations/0012_cascade_deletion.py index 1375fbb9..5f35b17d 100644 --- a/organizations/migrations/0012_cascade_deletion.py +++ b/organizations/migrations/0012_cascade_deletion.py @@ -1,7 +1,7 @@ # Generated by Django 2.0.5 on 2019-07-18 22:59 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/organizations/migrations/0013_add_manager_group_permissions.py b/organizations/migrations/0013_add_manager_group_permissions.py index 23e357de..2830cdbe 100644 --- a/organizations/migrations/0013_add_manager_group_permissions.py +++ b/organizations/migrations/0013_add_manager_group_permissions.py @@ -59,7 +59,8 @@ def forwards(apps, schema_editor): ) group.permissions.add(permission) print( - f' - {group.name}: added permission "{permission.name}" ({permission.codename})' + f' - {group.name}: added permission "{permission.name}" ' + f"({permission.codename})" ) OrganizationMembershipModel = apps.get_model( diff --git a/organizations/models.py b/organizations/models.py index 4f4737ea..41e629b7 100644 --- a/organizations/models.py +++ b/organizations/models.py @@ -1,10 +1,9 @@ # coding: utf-8 -from django.urls import reverse from django.db import models +from django.urls import reverse from django.utils.translation import gettext_lazy as _ from accounts.models import UserAccount -from scheduler.models import Shift from .managers import FacilityManager @@ -118,14 +117,8 @@ def get_absolute_url(self): class Facility(models.Model): - """Facilities are the places where the voluntary work is done, - mainly where refugees live or administrative places. - - Has fields: organization (org. that is running the fac.,foreign-key to organization), - name, short description, description, contact info, - members (User account many2many Facility), - place, adress, zip-code, show_on_map, latitude, longitude, slug, - timeline enabled and join mode. + """ + Facilities are the places where the voluntary work is done. """ class TimelineViewMode: @@ -227,11 +220,10 @@ def get_absolute_url(self): class OrganizationMembership(Membership): - """Users membership of organizations. + """ + Users membership at organizations. Inherits from Membership which has a foreign key to user account. - Has a foreign key field to Organization, - so this is the many2many model of the m2m relationship user accounts/organization. """ related_name = "organizations" @@ -261,11 +253,10 @@ def __str__(self): class FacilityMembership(Membership): - """Users membership of facilities. + """ + Users membership of facilities. Inherits from Membership which has a foreign key to user account. - Has a foreign key field to Facility, - so this is the many2many model of the m2m relationship user accounts/facility. """ related_name = "facilities" @@ -295,10 +286,10 @@ def __str__(self): class Workplace(models.Model): - """Workplaces are places at the facilities, where work is done, - eg. kitchen or clothing store. + """ + Workplaces are places at the facilities, where work is done. - Has foreign key to facility, name and description. + Examples: kitchen or clothing store. """ # the facility the workplace belongs to diff --git a/organizations/signals.py b/organizations/signals.py index eac78db2..461019e4 100644 --- a/organizations/signals.py +++ b/organizations/signals.py @@ -2,13 +2,12 @@ from django.contrib.auth.models import Group from django.db import transaction -from django.db.models.signals import post_save, post_delete +from django.db.models.signals import post_delete, post_save from django.dispatch import receiver - from django.utils.translation import gettext_lazy as _ -from .models import Membership, FacilityMembership, OrganizationMembership -from .settings import ORGANIZATION_MANAGER_GROUPNAME, FACILITY_MANAGER_GROUPNAME +from .models import FacilityMembership, Membership, OrganizationMembership +from .settings import FACILITY_MANAGER_GROUPNAME, ORGANIZATION_MANAGER_GROUPNAME logger = logging.getLogger(__name__) @@ -20,7 +19,8 @@ class MembershipGroupUpdateException(Exception): @transaction.atomic def update_group_for_user(user_account, membership_set, group_name): """ - Check django.contrib.auth groups of user in user_account and add or remove groups for its memberships. + Check django.contrib.auth groups of user in user_account and add or remove groups + for its memberships. :param user_account: the user account of the associated user to update the groups of :param membership_set: the membership set (reverse relation) to consider @@ -36,10 +36,12 @@ def update_group_for_user(user_account, membership_set, group_name): f"User '{user}' manager status of a facility/organization was changed. " f"We tried to automatically update facility/organization manager " f"group '{group_name}' for them, but no such group exists. " - f"In order to auto-assign permission groups to de-/resignated facility managers or organization " - f"managers, please make sure, to configure the permission group names in your VP installation settings " - f'module ORGANIZATION_MANAGER_GROUPNAME (default: "{ORGANIZATION_MANAGER_GROUPNAME}") and ' - f'FACILITY_MANAGER_GROUPNAME (default: "{FACILITY_MANAGER_GROUPNAME}") exactly as they are ' + f"In order to auto-assign permission groups to de-/resignated facility " + f"managers or organization managers, please make sure, to configure " + f"the permission group names in your VP installation settings module " + f"ORGANIZATION_MANAGER_GROUPNAME (default: " + f'"{ORGANIZATION_MANAGER_GROUPNAME}") and FACILITY_MANAGER_GROUPNAME ' + f'(default: "{FACILITY_MANAGER_GROUPNAME}") exactly as they are ' f"named in the database." ) ) @@ -53,15 +55,15 @@ def update_group_for_user(user_account, membership_set, group_name): user.save() else: user.groups.remove(group) - # Revoking the user is_staff flag here is not save, because it can not be known, if the user has this flag - # for another reason, too. + # Revoking the user is_staff flag here is not save, because it can not be known, + # if the user has this flag for another reason, too. @receiver([post_save, post_delete], sender=FacilityMembership) def handle_facility_membership_change(sender, instance, **kwargs): """ - Update the django.contrib.auth groups of the associated user object, whenever a facility membership for it is - created, changed or deleted. + Update the django.contrib.auth groups of the associated user object, whenever a + facility membership for it is created, changed or deleted. """ try: user_account = instance.user_account @@ -80,8 +82,8 @@ def handle_facility_membership_change(sender, instance, **kwargs): @receiver((post_save, post_delete), sender=OrganizationMembership) def handle_organization_membership_change(sender, instance, **kwargs): """ - Update the django.contrib.auth groups of the associated user object, whenever a organization membership for it is - created, changed or deleted. + Update the django.contrib.auth groups of the associated user object, whenever a + organization membership for it is created, changed or deleted. """ try: user_account = instance.user_account diff --git a/organizations/templatetags/memberships.py b/organizations/templatetags/memberships.py index 4ba059a2..b454f727 100644 --- a/organizations/templatetags/memberships.py +++ b/organizations/templatetags/memberships.py @@ -3,8 +3,8 @@ from django import template from django.db.models import Count -from organizations.admin import get_cached_memberships, filter_queryset_by_membership -from organizations.models import Membership, FacilityMembership +from organizations.admin import filter_queryset_by_membership, get_cached_memberships +from organizations.models import FacilityMembership, Membership register = template.Library() diff --git a/organizations/tests.py b/organizations/tests.py index 6ae43bcc..a730dbb2 100644 --- a/organizations/tests.py +++ b/organizations/tests.py @@ -1,4 +1,3 @@ # coding=utf-8 -from django.test import TestCase # Create your tests here. diff --git a/organizations/urls.py b/organizations/urls.py index cef00292..8dafc99a 100644 --- a/organizations/urls.py +++ b/organizations/urls.py @@ -3,10 +3,10 @@ from django.urls import re_path from .views import ( - OrganizationView, FacilityView, ManageFacilityMembersView, managing_members_view, + OrganizationView, ) urlpatterns = [ diff --git a/organizations/views.py b/organizations/views.py index aa428ddd..a68fdd44 100644 --- a/organizations/views.py +++ b/organizations/views.py @@ -7,20 +7,19 @@ from django.contrib.auth.mixins import LoginRequiredMixin from django.core.mail import EmailMessage from django.db.models import Prefetch -from django.urls import reverse from django.http import HttpResponseForbidden from django.template.defaultfilters import date from django.template.loader import get_template +from django.urls import reverse from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy as _ from django.views.generic import DetailView from django_ajax.decorators import ajax -from osm_tools.templatetags.osm_links import osm_search -from news.models import NewsEntry from organizations.admin import filter_queryset_by_membership +from osm_tools.templatetags.osm_links import osm_search from scheduler.models import Shift -from .models import Organization, Facility, FacilityMembership +from .models import Facility, FacilityMembership, Organization class OrganizationView(DetailView): @@ -129,32 +128,28 @@ def get_queryset(self): def send_membership_approved_notification(membership, approved_by): + template = get_template("emails/membership_approved.txt") + context = { + "username": membership.user_account.user.username, + "facility_name": membership.facility.name, + } + message = template.render(context) + subject = _("volunteer-planner.org: Membership approved") - try: - template = get_template("emails/membership_approved.txt") - context = { - "username": membership.user_account.user.username, - "facility_name": membership.facility.name, - } - message = template.render(context) - subject = _("volunteer-planner.org: Membership approved") - - from_email = settings.DEFAULT_FROM_EMAIL - reply_to = approved_by.email - to = membership.user_account.user.email - - addresses = (to,) - - mail = EmailMessage( - subject=subject, - body=message, - to=addresses, - from_email=from_email, - reply_to=reply_to, - ) - mail.send() - except: - raise + from_email = settings.DEFAULT_FROM_EMAIL + reply_to = approved_by.email + to = membership.user_account.user.email + + addresses = (to,) + + mail = EmailMessage( + subject=subject, + body=message, + to=addresses, + from_email=from_email, + reply_to=reply_to, + ) + mail.send() def get_facility_details(facility): diff --git a/places/admin.py b/places/admin.py index 2779d6c4..5b495b35 100644 --- a/places/admin.py +++ b/places/admin.py @@ -1,7 +1,7 @@ # coding=utf-8 from django.contrib import admin -from .models import Country, Region, Area, Place +from .models import Area, Country, Place, Region @admin.register(Country) diff --git a/places/migrations/0001_initial.py b/places/migrations/0001_initial.py index 7a5cc365..04e959a8 100644 --- a/places/migrations/0001_initial.py +++ b/places/migrations/0001_initial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/places/migrations/0002_auto_20150926_2313.py b/places/migrations/0002_auto_20150926_2313.py index 0fc1c89b..c627304a 100644 --- a/places/migrations/0002_auto_20150926_2313.py +++ b/places/migrations/0002_auto_20150926_2313.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/places/migrations/0003_protect_deletion.py b/places/migrations/0003_protect_deletion.py index dece8dea..d37cefcc 100644 --- a/places/migrations/0003_protect_deletion.py +++ b/places/migrations/0003_protect_deletion.py @@ -1,7 +1,7 @@ # Generated by Django 2.0.5 on 2019-07-18 22:59 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/places/models.py b/places/models.py index feb5735f..083559d4 100644 --- a/places/models.py +++ b/places/models.py @@ -1,8 +1,8 @@ # coding: utf-8 from django.db import models -from django.utils.translation import gettext_lazy as _ from django.urls import reverse +from django.utils.translation import gettext_lazy as _ class BreadcrumpablePlaceManager(models.Manager): diff --git a/scheduler/admin.py b/scheduler/admin.py index 95f4d0cc..57b43f1d 100644 --- a/scheduler/admin.py +++ b/scheduler/admin.py @@ -1,3 +1,5 @@ +import logging + from django import forms from django.contrib import admin from django.core.exceptions import ValidationError @@ -6,14 +8,22 @@ from django.utils.html import format_html, mark_safe from django.utils.translation import gettext_lazy as _ -from organizations.admin import MembershipFilteredAdmin, MembershipFieldListFilter +from organizations.admin import MembershipFieldListFilter, MembershipFilteredAdmin from . import models from .fields import FormattedModelChoiceIteratorFactory -import logging logger = logging.getLogger(__name__) +def facility_mismatch_error_message(object, facility): + title = _("Facilities do not match.") + text = _( + f'"{object.name}" belongs to facility "{object.facility.name}", but shift \ +takes place at "{facility.name}".' + ) + return f"{title} {text}" + + class FormattedModelChoiceFieldAdminMixin: fk_label_formats = None @@ -62,29 +72,19 @@ def clean(self): task = self.cleaned_data.get("task") if task and not task.facility == facility: - msg = ( - str(_(f"Facilities do not match.")) - + " " - + str( - _( - f'"{task.name}" belongs to facility "{task.facility.name}", but shift takes place at "{facility.name}".' - ) - ) + self.add_error( + "task", + ValidationError(facility_mismatch_error_message(task, facility)), ) - self.add_error("task", ValidationError(msg)) workplace = self.cleaned_data.get("workplace") if workplace and not workplace.facility == facility: - msg = ( - str(_(f"Facilities do not match.")) - + " " - + str( - _( - f'"{workplace.name}" is at "{workplace.facility.name}" but shift takes place at "{facility.name}".' - ) - ) + self.add_error( + "workplace", + ValidationError( + facility_mismatch_error_message(workplace, facility) + ), ) - self.add_error("workplace", ValidationError(msg)) # No times, no joy if not start: diff --git a/scheduler/management/commands/create_dummy_data.py b/scheduler/management/commands/create_dummy_data.py index 542047ed..4598ba23 100644 --- a/scheduler/management/commands/create_dummy_data.py +++ b/scheduler/management/commands/create_dummy_data.py @@ -1,34 +1,33 @@ # coding: utf-8 +import datetime import random import string -import datetime import factory +from django.contrib.auth.models import User from django.core.management.base import BaseCommand from django.db import transaction from django.db.models import signals from django.utils import timezone from registration.models import RegistrationProfile -from django.contrib.auth.models import User from accounts.models import UserAccount from news.models import NewsEntry - -from organizations.models import Facility, Workplace, Task, Organization +from organizations.models import Facility, Organization, Task, Workplace +from places.models import Area, Country, Place, Region +from scheduler.models import Shift, ShiftHelper from tests.factories import ( - ShiftHelperFactory, - ShiftFactory, FacilityFactory, - PlaceFactory, OrganizationFactory, + PlaceFactory, + ShiftFactory, + ShiftHelperFactory, TaskFactory, - WorkplaceFactory, - UserFactory, UserAccountFactory, + UserFactory, + WorkplaceFactory, ) -from scheduler.models import Shift, ShiftHelper -from places.models import Region, Area, Place, Country HELPTOPICS = [ "Jumper", @@ -71,10 +70,10 @@ def random_string(length=10): class Command(BaseCommand): help = ( - "this command creates dummy data for the entire " - 'application execute "python manage.py create_dummy_data 30 --flush True"' - "to first delete all data in the database and then ad random shifts for 30 days." - 'if you don\'t want to delete data just not add "flush True" ' + "This command creates dummy data for the entire application.\n" + 'Execute "python manage.py create_dummy_data 30 --flush True" to first ' + "delete all data in the database and then add random shifts for 30 days. " + 'if you don`t want to delete data just not add "flush True".' ) args = "" @@ -170,7 +169,7 @@ def handle(self, *args, **options): workplace=workplace, ) # assign random volunteer for each shift - reg_user = ShiftHelperFactory.create(shift=shift) + ShiftHelperFactory.create(shift=shift) for i in range(0, 5): UserAccountFactory.create(user=UserFactory.create(username=f"user{i}")) diff --git a/scheduler/management/commands/sqldump.py b/scheduler/management/commands/sqldump.py index 63d0655a..77efc0fe 100644 --- a/scheduler/management/commands/sqldump.py +++ b/scheduler/management/commands/sqldump.py @@ -1,10 +1,9 @@ # coding=utf-8 +import datetime import os from django.conf import settings from django.core.management.base import BaseCommand -import datetime - from django.utils import timezone diff --git a/scheduler/management/commands/sqlimport.py b/scheduler/management/commands/sqlimport.py index 93d0c266..cbca630b 100644 --- a/scheduler/management/commands/sqlimport.py +++ b/scheduler/management/commands/sqlimport.py @@ -1,10 +1,9 @@ # coding=utf-8 +import datetime import os from django.conf import settings from django.core.management.base import BaseCommand -import datetime - from django.utils import timezone diff --git a/scheduler/managers.py b/scheduler/managers.py index 34c53700..c8bdc11c 100644 --- a/scheduler/managers.py +++ b/scheduler/managers.py @@ -2,9 +2,9 @@ from datetime import datetime, time, timedelta +from django.conf import settings from django.db import models from django.utils import timezone -from django.conf import settings from places import models as place_models @@ -98,7 +98,8 @@ def conflicting( """ grace = grace or timedelta(0) - # correct grace for short shifts, otherwise a user could join two concurrent 1-hour-shifts + # correct grace for short shifts, otherwise a user could join two + # concurrent 1-hour-shifts if shift.duration <= grace: grace = shift.duration / 2 graced_start = shift.starting_time + grace diff --git a/scheduler/migrations/0001_initial.py b/scheduler/migrations/0001_initial.py index 4c8d124f..e447c650 100644 --- a/scheduler/migrations/0001_initial.py +++ b/scheduler/migrations/0001_initial.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations from django.conf import settings +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0002_need_achivated.py b/scheduler/migrations/0002_need_achivated.py index 4103e521..eb9e6964 100644 --- a/scheduler/migrations/0002_need_achivated.py +++ b/scheduler/migrations/0002_need_achivated.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0003_volunteers_needs.py b/scheduler/migrations/0003_volunteers_needs.py index b74dfdbf..31df2ab8 100644 --- a/scheduler/migrations/0003_volunteers_needs.py +++ b/scheduler/migrations/0003_volunteers_needs.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0004_auto_20150818_2355.py b/scheduler/migrations/0004_auto_20150818_2355.py index 0367611b..14b53171 100644 --- a/scheduler/migrations/0004_auto_20150818_2355.py +++ b/scheduler/migrations/0004_auto_20150818_2355.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0005_need_location.py b/scheduler/migrations/0005_need_location.py index 0920b25a..c2f205d1 100644 --- a/scheduler/migrations/0005_need_location.py +++ b/scheduler/migrations/0005_need_location.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0006_auto_20150819_0134.py b/scheduler/migrations/0006_auto_20150819_0134.py index 9ae74ed6..e4d21a3a 100644 --- a/scheduler/migrations/0006_auto_20150819_0134.py +++ b/scheduler/migrations/0006_auto_20150819_0134.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): @@ -63,8 +63,9 @@ class Migration(migrations.Migration): field=models.ForeignKey( verbose_name=b"Hilfetyp", to="scheduler.Topics", - help_text="Jeder Hilfetyp hat so viele Planelemente wie es Arbeitsschichten geben " - "soll. Dies ist EINE Arbeitsschicht f\xfcr einen bestimmten Tag", + help_text="Jeder Hilfetyp hat so viele Planelemente wie es " + "Arbeitsschichten geben soll. Dies ist EINE Arbeitsschicht " + "f\xfcr einen bestimmten Tag", on_delete=models.CASCADE, ), ), diff --git a/scheduler/migrations/0007_auto_20150819_0138.py b/scheduler/migrations/0007_auto_20150819_0138.py index b90d5fc8..bab16a90 100644 --- a/scheduler/migrations/0007_auto_20150819_0138.py +++ b/scheduler/migrations/0007_auto_20150819_0138.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations class Migration(migrations.Migration): diff --git a/scheduler/migrations/0008_blueprint_needcreator.py b/scheduler/migrations/0008_blueprint_needcreator.py index e0f26571..d1530dbf 100644 --- a/scheduler/migrations/0008_blueprint_needcreator.py +++ b/scheduler/migrations/0008_blueprint_needcreator.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0009_auto_20150823_1546.py b/scheduler/migrations/0009_auto_20150823_1546.py index 1fec7663..101ec1ad 100644 --- a/scheduler/migrations/0009_auto_20150823_1546.py +++ b/scheduler/migrations/0009_auto_20150823_1546.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations class Migration(migrations.Migration): diff --git a/scheduler/migrations/0010_auto_20150904_0014.py b/scheduler/migrations/0010_auto_20150904_0014.py index 40caf593..734f5306 100644 --- a/scheduler/migrations/0010_auto_20150904_0014.py +++ b/scheduler/migrations/0010_auto_20150904_0014.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations class Migration(migrations.Migration): diff --git a/scheduler/migrations/0011_auto_20150906_2341.py b/scheduler/migrations/0011_auto_20150906_2341.py index ac79d66c..1fa1e018 100644 --- a/scheduler/migrations/0011_auto_20150906_2341.py +++ b/scheduler/migrations/0011_auto_20150906_2341.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations class Migration(migrations.Migration): diff --git a/scheduler/migrations/0013_auto_20150912_1334.py b/scheduler/migrations/0013_auto_20150912_1334.py index 2dfc94ef..f7bf289b 100644 --- a/scheduler/migrations/0013_auto_20150912_1334.py +++ b/scheduler/migrations/0013_auto_20150912_1334.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations class Migration(migrations.Migration): diff --git a/scheduler/migrations/0014_remove_need_activate.py b/scheduler/migrations/0014_remove_need_activate.py index 5bec69a3..6a0ffc57 100644 --- a/scheduler/migrations/0014_remove_need_activate.py +++ b/scheduler/migrations/0014_remove_need_activate.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations class Migration(migrations.Migration): diff --git a/scheduler/migrations/0015_auto_20150912_1732.py b/scheduler/migrations/0015_auto_20150912_1732.py index f6e5cd85..0b6d7127 100644 --- a/scheduler/migrations/0015_auto_20150912_1732.py +++ b/scheduler/migrations/0015_auto_20150912_1732.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0015_auto_20150912_1740.py b/scheduler/migrations/0015_auto_20150912_1740.py index 11aecfb6..c0b99767 100644 --- a/scheduler/migrations/0015_auto_20150912_1740.py +++ b/scheduler/migrations/0015_auto_20150912_1740.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0016_auto_20150912_2049.py b/scheduler/migrations/0016_auto_20150912_2049.py index be1254d9..b027aa1f 100644 --- a/scheduler/migrations/0016_auto_20150912_2049.py +++ b/scheduler/migrations/0016_auto_20150912_2049.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations class Migration(migrations.Migration): diff --git a/scheduler/migrations/0017_merge.py b/scheduler/migrations/0017_merge.py index 8d497007..5e9409ac 100644 --- a/scheduler/migrations/0017_merge.py +++ b/scheduler/migrations/0017_merge.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations class Migration(migrations.Migration): diff --git a/scheduler/migrations/0018_auto_20150912_2134.py b/scheduler/migrations/0018_auto_20150912_2134.py index e8f3a25b..2c68983e 100644 --- a/scheduler/migrations/0018_auto_20150912_2134.py +++ b/scheduler/migrations/0018_auto_20150912_2134.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0019_auto_20150915_0101.py b/scheduler/migrations/0019_auto_20150915_0101.py index 667fdfc1..ab1a568e 100644 --- a/scheduler/migrations/0019_auto_20150915_0101.py +++ b/scheduler/migrations/0019_auto_20150915_0101.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0019_remove_time_periods.py b/scheduler/migrations/0019_remove_time_periods.py index 69b531dd..12b6a96d 100644 --- a/scheduler/migrations/0019_remove_time_periods.py +++ b/scheduler/migrations/0019_remove_time_periods.py @@ -2,7 +2,7 @@ from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models def skip(*_): diff --git a/scheduler/migrations/0020_Fix_Working_Hours.py b/scheduler/migrations/0020_Fix_Working_Hours.py index 3d3286ff..db7c3407 100644 --- a/scheduler/migrations/0020_Fix_Working_Hours.py +++ b/scheduler/migrations/0020_Fix_Working_Hours.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0021_add_shift_users.py b/scheduler/migrations/0021_add_shift_users.py index 1f117f2f..4860b51e 100644 --- a/scheduler/migrations/0021_add_shift_users.py +++ b/scheduler/migrations/0021_add_shift_users.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0021_auto_20150922_1555.py b/scheduler/migrations/0021_auto_20150922_1555.py index 4a38aca1..0560e7c1 100644 --- a/scheduler/migrations/0021_auto_20150922_1555.py +++ b/scheduler/migrations/0021_auto_20150922_1555.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations class Migration(migrations.Migration): diff --git a/scheduler/migrations/0021_merge.py b/scheduler/migrations/0021_merge.py index f5f224f0..17673153 100644 --- a/scheduler/migrations/0021_merge.py +++ b/scheduler/migrations/0021_merge.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations class Migration(migrations.Migration): diff --git a/scheduler/migrations/0022_auto_20150923_1705.py b/scheduler/migrations/0022_auto_20150923_1705.py index a22a7b94..f210fc7e 100644 --- a/scheduler/migrations/0022_auto_20150923_1705.py +++ b/scheduler/migrations/0022_auto_20150923_1705.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations class Migration(migrations.Migration): diff --git a/scheduler/migrations/0024_auto_20150926_2313.py b/scheduler/migrations/0024_auto_20150926_2313.py index 215d8743..cdbe9b80 100644 --- a/scheduler/migrations/0024_auto_20150926_2313.py +++ b/scheduler/migrations/0024_auto_20150926_2313.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0025_merge.py b/scheduler/migrations/0025_merge.py index edada241..5c6adcbf 100644 --- a/scheduler/migrations/0025_merge.py +++ b/scheduler/migrations/0025_merge.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations class Migration(migrations.Migration): diff --git a/scheduler/migrations/0027_topics_workplace.py b/scheduler/migrations/0027_topics_workplace.py index d570c095..c8430786 100644 --- a/scheduler/migrations/0027_topics_workplace.py +++ b/scheduler/migrations/0027_topics_workplace.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0028_need_facility.py b/scheduler/migrations/0028_need_facility.py index 5a543763..db04451c 100644 --- a/scheduler/migrations/0028_need_facility.py +++ b/scheduler/migrations/0028_need_facility.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0030_delete_location.py b/scheduler/migrations/0030_delete_location.py index d5095f3d..6aa0d734 100644 --- a/scheduler/migrations/0030_delete_location.py +++ b/scheduler/migrations/0030_delete_location.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0031_rename_need_to_shift.py b/scheduler/migrations/0031_rename_need_to_shift.py index 8740d3ac..5f54de92 100644 --- a/scheduler/migrations/0031_rename_need_to_shift.py +++ b/scheduler/migrations/0031_rename_need_to_shift.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0032_add_task_and_workplace_to_shift.py b/scheduler/migrations/0032_add_task_and_workplace_to_shift.py index 7757d990..bb264db6 100644 --- a/scheduler/migrations/0032_add_task_and_workplace_to_shift.py +++ b/scheduler/migrations/0032_add_task_and_workplace_to_shift.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0034_make_task_required.py b/scheduler/migrations/0034_make_task_required.py index 8bc7f7f5..4bbd461d 100644 --- a/scheduler/migrations/0034_make_task_required.py +++ b/scheduler/migrations/0034_make_task_required.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0036_shift_members_only.py b/scheduler/migrations/0036_shift_members_only.py index ae599934..1b22cb0c 100644 --- a/scheduler/migrations/0036_shift_members_only.py +++ b/scheduler/migrations/0036_shift_members_only.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0037_slots_positive_integer.py b/scheduler/migrations/0037_slots_positive_integer.py index 9a6667fa..254a7c8a 100644 --- a/scheduler/migrations/0037_slots_positive_integer.py +++ b/scheduler/migrations/0037_slots_positive_integer.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/migrations/0038_protect_deletion.py b/scheduler/migrations/0038_protect_deletion.py index c3f1ab26..70cd9a8a 100644 --- a/scheduler/migrations/0038_protect_deletion.py +++ b/scheduler/migrations/0038_protect_deletion.py @@ -1,7 +1,7 @@ # Generated by Django 2.0.5 on 2019-07-18 22:59 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduler/models.py b/scheduler/models.py index b1e049a1..fa6b65b2 100644 --- a/scheduler/models.py +++ b/scheduler/models.py @@ -2,16 +2,13 @@ import logging from datetime import time -from django.urls import reverse from django.db import models -from django.utils.timezone import datetime +from django.urls import reverse from django.utils.formats import localize from django.utils.translation import gettext_lazy as _, ngettext_lazy -from places.models import Country, Region, Area, Place from . import managers - logger = logging.getLogger(__name__) diff --git a/scheduler/place_urls.py b/scheduler/place_urls.py index fa4a9f30..6537885f 100644 --- a/scheduler/place_urls.py +++ b/scheduler/place_urls.py @@ -2,8 +2,7 @@ from django.urls import re_path -from places.models import Country, Region, Area, Place - +from places.models import Area, Country, Place, Region from .views import GeographicHelpdeskView urlpatterns = [ @@ -18,12 +17,12 @@ name="region-details", ), re_path( - r"^(?P[-\w]+)/(?P[-\w]+)/(?P[-\w]+)/?$", + r"^(?P[-\w]+)/(?P[-\w]+)/(?P[-\w]+)/?$", # noqa: E501 GeographicHelpdeskView.as_view(model=Area), name="area-details", ), re_path( - r"^(?P[-\w]+)/(?P[-\w]+)/(?P[-\w]+)/(?P[-\w]+)/?$", + r"^(?P[-\w]+)/(?P[-\w]+)/(?P[-\w]+)/(?P[-\w]+)/?$", # noqa: E501 GeographicHelpdeskView.as_view(model=Place), name="place-details", ), diff --git a/scheduler/signals.py b/scheduler/signals.py index fdb319bc..e2acd853 100644 --- a/scheduler/signals.py +++ b/scheduler/signals.py @@ -1,6 +1,5 @@ # coding=utf-8 import logging -from django.utils.timezone import timedelta from django.conf import settings from django.core.mail import EmailMessage @@ -9,6 +8,7 @@ from django.template.defaultfilters import time as date_filter from django.template.loader import render_to_string from django.utils import timezone +from django.utils.timezone import timedelta from scheduler.models import Shift @@ -39,7 +39,7 @@ def send_email_notifications(sender, instance, **kwargs): ) from_email = settings.DEFAULT_FROM_EMAIL - # TODO Find a way to identify current manager or give facility an e-mail address + # TODO: identify current manager or give facility an e-mail address reply_to = ["kontakt@volunteer-planner.org"] addresses = shift.helpers.values_list("user__email", flat=True) @@ -53,9 +53,8 @@ def send_email_notifications(sender, instance, **kwargs): reply_to=reply_to, ) mail.send() - except Exception as e: + except Exception: logger.exception("Error sending notification email (Shift: %s)" % instance) - pass def times_changed(shift, old_shift, grace=timedelta(minutes=5)): @@ -102,7 +101,8 @@ def notify_users_shift_change(sender, instance, **kwargs): bcc=addresses, ) logger.info( - "Shift %s at %s changed: (%s-%s -> %s->%s). Sending email notification to %d affected user(s).", + "Shift %s at %s changed: (%s-%s -> %s->%s). Sending email " + "notification to %d affected user(s).", shift.task.name, shift.facility.name, old_shift.starting_time, diff --git a/scheduler/urls.py b/scheduler/urls.py index 05a2f0fa..c894cbf6 100644 --- a/scheduler/urls.py +++ b/scheduler/urls.py @@ -6,23 +6,24 @@ urlpatterns = [ re_path(r"^$", HelpDesk.as_view(), name="helpdesk"), - # (A): needed for direct access of of a shift details site - # via shifthelper.shift.get_absolute_url() (+"/direct/) (C) is needed for other things - # (example of get_absolute_url() of a shift is: /helpdesk/facility190/shifts/2016/1/15/81 ) + # (A): needed for direct access of of a shift details site via + # shifthelper.shift.get_absolute_url() (+"/direct/) (C) is needed for + # other things (example of get_absolute_url() of a shift is: + # /helpdesk/facility190/shifts/2016/1/15/81 ) re_path( - r"^(?P[^/]+)/shifts/(?P\d{4})/(?P\d{1,2})/(?P\d{1,2})/(?P\d+)/direct/?$", + r"^(?P[^/]+)/shifts/(?P\d{4})/(?P\d{1,2})/(?P\d{1,2})/(?P\d+)/direct/?$", # noqa: E501 PlannerView.as_view(), name="planner_by_facility", ), # (B): re_path( - r"^(?P[^/]+)/shifts/(?P\d{4})/(?P\d{1,2})/(?P\d{1,2})/?$", + r"^(?P[^/]+)/shifts/(?P\d{4})/(?P\d{1,2})/(?P\d{1,2})/?$", # noqa: E501 PlannerView.as_view(), name="planner_by_facility", ), # (C): re_path( - r"^(?P[^/]+)/shifts/(?P\d{4})/(?P\d{1,2})/(?P\d{1,2})/(?P\d+)/?$", + r"^(?P[^/]+)/shifts/(?P\d{4})/(?P\d{1,2})/(?P\d{1,2})/(?P\d+)/?$", # noqa: E501 ShiftDetailView.as_view(), name="shift_details", ), diff --git a/scheduler/views.py b/scheduler/views.py index adaf5b2f..e1ea0124 100644 --- a/scheduler/views.py +++ b/scheduler/views.py @@ -5,16 +5,16 @@ from datetime import date from django.contrib import messages -from django.contrib.admin.models import LogEntry, DELETION +from django.contrib.admin.models import DELETION, LogEntry from django.contrib.contenttypes.models import ContentType from django.core.serializers.json import DjangoJSONEncoder -from django.http import Http404 -from django.urls import reverse from django.db.models import Count, Prefetch +from django.http import Http404 from django.shortcuts import get_object_or_404 +from django.urls import reverse from django.utils.safestring import mark_safe from django.utils.translation import gettext_lazy as _ -from django.views.generic import TemplateView, FormView, DetailView +from django.views.generic import DetailView, FormView, TemplateView from accounts.models import UserAccount from organizations.models import Facility, FacilityMembership @@ -23,8 +23,7 @@ is_membership_pending, ) from organizations.views import get_facility_details -from scheduler.models import Shift -from scheduler.models import ShiftHelper +from scheduler.models import Shift, ShiftHelper from volunteer_planner.utils import LoginRequiredMixin from .forms import RegisterForShiftForm @@ -256,7 +255,8 @@ def form_valid(self, form): if hard_conflicted_shifts: error_message = _( - "We can't add you to this shift because you've already agreed to other shifts at the same time:" + "We can't add you to this shift because you've already " + "agreed to other shifts at the same time:" ) message_list = "
    {}
".format( "\n".join( @@ -272,7 +272,8 @@ def form_valid(self, form): ) elif shift_to_join.slots - shift_to_join.volunteer_count <= 0: error_message = _( - "We can't add you to this shift because there are no more slots left." + "We can't add you to this shift because there are no more " + "slots left." ) messages.warning(self.request, error_message) else: @@ -286,7 +287,8 @@ def form_valid(self, form): if soft_conflicted_shifts: warning_message = _( - "The shift you joined overlaps with other shifts you already joined. Please check for " + "The shift you joined overlaps with other shifts " + "you already joined. Please check for " "conflicts:" ) message_list = "
    {}
".format( diff --git a/scheduletemplates/admin.py b/scheduletemplates/admin.py index fc881fa9..46bfa207 100644 --- a/scheduletemplates/admin.py +++ b/scheduletemplates/admin.py @@ -10,18 +10,19 @@ from django.template.response import TemplateResponse from django.templatetags.l10n import localize from django.urls import re_path -from django.utils import formats -from django.utils import timezone +from django.utils import formats, timezone from django.utils.translation import gettext_lazy as _, ngettext_lazy -from . import models from organizations.admin import ( filter_queryset_by_membership, MembershipFieldListFilter, MembershipFilteredAdmin, MembershipFilteredTabularInline, ) -from scheduler.admin import FormattedModelChoiceFieldAdminMixin +from scheduler.admin import ( + FormattedModelChoiceFieldAdminMixin, + facility_mismatch_error_message, +) from scheduler.models import Shift from .models import ScheduleTemplate, ShiftTemplate @@ -56,32 +57,22 @@ def clean(self): schedule_template = self.cleaned_data.get("schedule_template") if schedule_template: facility = schedule_template.facility - task = self.cleaned_data.get("task") + task = self.cleaned_data.get("task") if task and not task.facility == facility: - msg = ( - str(_(f"Facilities do not match.")) - + " " - + str( - _( - f'"{task.name}" belongs to facility "{task.facility.name}", but shift takes place at "{facility.name}".' - ) - ) + self.add_error( + "task", + ValidationError(facility_mismatch_error_message(task, facility)), ) - self.add_error("task", ValidationError(msg)) workplace = self.cleaned_data.get("workplace") if workplace and not workplace.facility == facility: - msg = ( - str(_(f"Facilities do not match.")) - + " " - + str( - _( - f'"{workplace.name}" is at "{workplace.facility.name}" but shift takes place at "{facility.name}".' - ) - ) + self.add_error( + "workplace", + ValidationError( + facility_mismatch_error_message(workplace, facility) + ), ) - self.add_error("workplace", ValidationError(msg)) class ShiftTemplateInline( @@ -121,9 +112,6 @@ def translate_date_format(format_string, mappings=JQUERYUI_FORMAT_MAPPING): class ApplyTemplateForm(forms.Form): """ Form that lets one select a date. - - TODO: Also select shifts via the form instead of inspecting raw POST data. - https://docs.djangoproject.com/en/1.8/ref/forms/fields/#modelmultiplechoicefield """ apply_for_date = forms.DateField(widget=DateInput) diff --git a/scheduletemplates/migrations/0001_initial.py b/scheduletemplates/migrations/0001_initial.py index b776ed8e..f0749241 100644 --- a/scheduletemplates/migrations/0001_initial.py +++ b/scheduletemplates/migrations/0001_initial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduletemplates/migrations/0002_auto_20151013_2229.py b/scheduletemplates/migrations/0002_auto_20151013_2229.py index 22fcb1e6..e1784a62 100644 --- a/scheduletemplates/migrations/0002_auto_20151013_2229.py +++ b/scheduletemplates/migrations/0002_auto_20151013_2229.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations class Migration(migrations.Migration): diff --git a/scheduletemplates/migrations/0003_auto_20151023_1800.py b/scheduletemplates/migrations/0003_auto_20151023_1800.py index afb56b01..6ac4b19d 100644 --- a/scheduletemplates/migrations/0003_auto_20151023_1800.py +++ b/scheduletemplates/migrations/0003_auto_20151023_1800.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduletemplates/migrations/0004_shifttemplate_members_only.py b/scheduletemplates/migrations/0004_shifttemplate_members_only.py index acb3fc97..5641840d 100644 --- a/scheduletemplates/migrations/0004_shifttemplate_members_only.py +++ b/scheduletemplates/migrations/0004_shifttemplate_members_only.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduletemplates/migrations/0005_cascade_deletion.py b/scheduletemplates/migrations/0005_cascade_deletion.py index 2370c29d..c2194ed8 100644 --- a/scheduletemplates/migrations/0005_cascade_deletion.py +++ b/scheduletemplates/migrations/0005_cascade_deletion.py @@ -1,7 +1,7 @@ # Generated by Django 2.0.5 on 2019-07-18 22:59 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/scheduletemplates/templatetags/scheduletemplates_tags.py b/scheduletemplates/templatetags/scheduletemplates_tags.py index 584a3608..93aa71ae 100644 --- a/scheduletemplates/templatetags/scheduletemplates_tags.py +++ b/scheduletemplates/templatetags/scheduletemplates_tags.py @@ -1,7 +1,6 @@ # coding: utf-8 from django import template -from django.utils.translation import pgettext_lazy from django.contrib.admin.templatetags.admin_modify import submit_row register = template.Library() diff --git a/scheduletemplates/views.py b/scheduletemplates/views.py index 91ea44a2..60f00ef0 100644 --- a/scheduletemplates/views.py +++ b/scheduletemplates/views.py @@ -1,3 +1 @@ -from django.shortcuts import render - # Create your views here. diff --git a/shiftmailer/migrations/0001_initial.py b/shiftmailer/migrations/0001_initial.py index 5fd55337..0dcfffaf 100644 --- a/shiftmailer/migrations/0001_initial.py +++ b/shiftmailer/migrations/0001_initial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/shiftmailer/migrations/0002_auto_20150912_2049.py b/shiftmailer/migrations/0002_auto_20150912_2049.py index 827b6101..3a79403f 100644 --- a/shiftmailer/migrations/0002_auto_20150912_2049.py +++ b/shiftmailer/migrations/0002_auto_20150912_2049.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/shiftmailer/migrations/0003_auto_20151002_1854.py b/shiftmailer/migrations/0003_auto_20151002_1854.py index 4a644a48..ab19e4b8 100644 --- a/shiftmailer/migrations/0003_auto_20151002_1854.py +++ b/shiftmailer/migrations/0003_auto_20151002_1854.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/shiftmailer/migrations/0004_location_to_facility.py b/shiftmailer/migrations/0004_location_to_facility.py index c4241429..bb03ef16 100644 --- a/shiftmailer/migrations/0004_location_to_facility.py +++ b/shiftmailer/migrations/0004_location_to_facility.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/tests/_behave/steps/landing_page_steps.py b/tests/_behave/steps/landing_page_steps.py index 4d7e7a0a..ce3a7789 100644 --- a/tests/_behave/steps/landing_page_steps.py +++ b/tests/_behave/steps/landing_page_steps.py @@ -1,9 +1,10 @@ -from behave import given, then import re +from behave import given, then + @given("I visit the home page") -def impl(context): +def visit_homepage(context): context.browser.get("http://localhost:8000/") @@ -42,7 +43,7 @@ def find_statistics(context): facts_div_containers = context.browser.find_elements_by_class_name("facts") stats_div = facts_div_containers[0] - stats_reg_ex = "(^[0-9]+\n[A-Za-z ]+\n)*(^[0-9]+\n[A-Za-z ]+$)\Z" + stats_reg_ex = r"(^[0-9]+\n[A-Za-z ]+\n)*(^[0-9]+\n[A-Za-z ]+$)\Z" match = re.match(stats_reg_ex, stats_div.text, re.MULTILINE) @@ -54,18 +55,18 @@ def find_areas_and_facilities(context): facts_div_containers = context.browser.find_elements_by_class_name("facts") areas_facilities_div = facts_div_containers[1] - regex_heading = "^.*\n" - regex_one_area = "(^[\w ]+\n([\w ]+\u2022)*[\w ]+)" - regex_at_least_one_area = "(" + regex_one_area + "\n)*" + regex_one_area - regex_placeholder_msg = "There are currently no places in need of help." + regex_heading = r"^.*\n" + regex_one_area = r"(^[\w ]+\n([\w ]+\u2022)*[\w ]+)" + regex_at_least_one_area = r"(" + regex_one_area + r"\n)*" + regex_one_area + regex_placeholder_msg = r"There are currently no places in need of help." regex_total = ( regex_heading - + "(" + + r"(" + regex_at_least_one_area - + "|" + + r"|" + regex_placeholder_msg - + ")" - + "\Z" + + r")" + + r"\Z" ) match = re.match(regex_total, areas_facilities_div.text, re.MULTILINE | re.UNICODE) diff --git a/tests/_behave/steps/smoke_steps.py b/tests/_behave/steps/smoke_steps.py index c6b99b18..6a950e5c 100644 --- a/tests/_behave/steps/smoke_steps.py +++ b/tests/_behave/steps/smoke_steps.py @@ -2,11 +2,11 @@ @given("I go to the homepage") -def impl(context): +def visit_homepage(context): context.browser.get("http://localhost:8000/") @then('"{title}" is in the page body') -def impl(context, title): +def find_title(context, title): if title not in context.browser.find_element_by_css_selector("body").text: raise Exception("Couldn't find text '%s' in the page." % title) diff --git a/tests/factories.py b/tests/factories.py index f915adcc..a42b39dd 100644 --- a/tests/factories.py +++ b/tests/factories.py @@ -3,15 +3,14 @@ from django.contrib.auth.models import User from django.utils import timezone - -from factory import Sequence, SubFactory, LazyAttribute, PostGenerationMethodCall +from factory import LazyAttribute, PostGenerationMethodCall, Sequence, SubFactory from factory.django import DjangoModelFactory from factory.fuzzy import FuzzyText from accounts import models as account_models -from scheduler import models as scheduler_models -from places import models as places_models from organizations import models as organization_models +from places import models as places_models +from scheduler import models as scheduler_models class CountryFactory(DjangoModelFactory): diff --git a/tests/registration/test_registration.py b/tests/registration/test_registration.py index 0d01e57e..3f57e226 100644 --- a/tests/registration/test_registration.py +++ b/tests/registration/test_registration.py @@ -1,9 +1,7 @@ # coding=utf-8 import pytest - -from django.test import TestCase, override_settings +from django.test import override_settings, TestCase from django.urls import reverse - from registration.models import RegistrationProfile from accounts.models import UserAccount @@ -81,15 +79,14 @@ def try_invalid_username(self, invalid_username): response = self.client.post(self.registration_url, user_data) form = response.context["form"] - assert ( - form is not None - ), "We expect the form to be displayed again if the submission failed" + assert form is not None, "Form not displayed again after submission failed" self.assertFormError( response, "form", "username", - "Enter a valid username. This value may contain only letters, numbers, and @/./+/-/_ characters.", + "Enter a valid username. This value may contain only letters, numbers, and " + "@/./+/-/_ characters.", ) assert RegistrationProfile.objects.count() == 0 diff --git a/tests/scheduler/test_models.py b/tests/scheduler/test_models.py index 5ab4cffb..fae7d707 100644 --- a/tests/scheduler/test_models.py +++ b/tests/scheduler/test_models.py @@ -18,7 +18,8 @@ def create_shift(start_hour, end_hour, facility=None): """ - Tiny helper because setting time periods is awkward till we remove the FK relationship. + Tiny helper because setting time periods is awkward till we remove the FK + relationship. """ create_args = dict( starting_time=datetime(2015, 1, 1, start_hour, tzinfo=get_current_timezone()), @@ -44,8 +45,8 @@ def assert_shift_conflict_count( class ShiftTestCase(TestCase): """ - We have some logic to detect conflicting shifts. This test case tests a few basic - cases. + We have some logic to detect conflicting shifts. This test case tests a few + basic cases. """ def setUp(self): @@ -142,7 +143,8 @@ def test_conflict_soft_only(self): class FacilityTestCase(TestCase): def test_shift_manager_for_facility(self): """ - checks that get_days_with_shifts() returns only dates later than datetime.now() + checks that get_days_with_shifts() returns only dates later than + timezone.now() """ now = timezone.now() yesterday_start = now - timedelta(1) @@ -156,7 +158,7 @@ def test_shift_manager_for_facility(self): task = TaskFactory.create(facility=facility) workplace = WorkplaceFactory.create(facility=facility) - yesterday_shift = ShiftFactory.create( + ShiftFactory.create( facility=facility, task=task, workplace=workplace, @@ -172,9 +174,11 @@ def test_shift_manager_for_facility(self): ending_time=tomorrow_end, ) - assert ( - Facility.objects.count() == 1 - ), "test case assumes that shifts have been created for the same facility, as the ShiftFactory indeed does at the time of writing of this test case" + assert Facility.objects.count() == 1, ( + "test case assumes that shifts have been created for the same " + "facility, as the ShiftFactory indeed does at the time of writing " + "of this test case" + ) assert Facility.objects.get() == task.facility shifts = Shift.open_shifts.filter(facility=facility) diff --git a/tests/scheduletemplates/test_dateformatconverter.py b/tests/scheduletemplates/test_dateformatconverter.py index 4ac441da..99ca2356 100644 --- a/tests/scheduletemplates/test_dateformatconverter.py +++ b/tests/scheduletemplates/test_dateformatconverter.py @@ -2,6 +2,7 @@ import pytest + from scheduletemplates.admin import translate_date_format diff --git a/volunteer_planner/settings/__init__.py b/volunteer_planner/settings/__init__.py index 9384db3d..70d19660 100644 --- a/volunteer_planner/settings/__init__.py +++ b/volunteer_planner/settings/__init__.py @@ -1,2 +1,2 @@ # coding=utf-8 -from .base import * +from .base import * # noqa: F401 diff --git a/volunteer_planner/settings/docker_mysql.py b/volunteer_planner/settings/docker_mysql.py index bab844a2..dcfcb323 100644 --- a/volunteer_planner/settings/docker_mysql.py +++ b/volunteer_planner/settings/docker_mysql.py @@ -1,6 +1,6 @@ # coding: utf-8 -from volunteer_planner.settings.local import * +from .local import * DATABASES = { "default": { diff --git a/volunteer_planner/settings/docker_postgres.py b/volunteer_planner/settings/docker_postgres.py index 0ab791cb..61423baa 100644 --- a/volunteer_planner/settings/docker_postgres.py +++ b/volunteer_planner/settings/docker_postgres.py @@ -1,6 +1,6 @@ # coding: utf-8 -from volunteer_planner.settings.local import * +from .local import * # noqa: F401 DATABASES = { "default": { diff --git a/volunteer_planner/settings/local.py b/volunteer_planner/settings/local.py index ba2b6f56..cc3411f4 100644 --- a/volunteer_planner/settings/local.py +++ b/volunteer_planner/settings/local.py @@ -1,7 +1,8 @@ # coding=utf-8 -from .base import * from datetime import timedelta +from .base import * # noqa: F401 + DEBUG = True INTERNAL_IPS = ("127.0.0.1",) @@ -12,7 +13,8 @@ DATABASES = { "default": { "ENGINE": "django.db.backends.sqlite3", - # Intentionally out of repository so that git clean doesn't delete the file. + # Intentionally out of repository so that git clean doesn't delete the + # file. "NAME": os.path.join(SITE_ROOT, "db.sqlite3"), } } @@ -37,8 +39,8 @@ "format": "%(levelname)s %(message)s", }, "verbose": { - "format": "%(asctime)s - %(name)s (%(filename)s:%(lineno)d) [%(levelname)s] " - "(%(process)d/%(thread)d): %(message)s", + "format": "%(asctime)s - %(name)s (%(filename)s:%(lineno)d) " + "[%(levelname)s] (%(process)d/%(thread)d): %(message)s", }, }, "handlers": { @@ -87,7 +89,8 @@ DEFAULT_SHIFT_CONFLICT_GRACE = timedelta(hours=1) -# for testing on mobile devices in local networks it's necessary to overwrite with a local ip -ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", ".localhost,127.0.0.1,[::1]").split( +# for testing on mobile devices in local networks it's necessary to overwrite +# with a local ip +ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "localhost,127.0.0.1,[::1]").split( sep="," ) diff --git a/volunteer_planner/settings/local_mysql.py b/volunteer_planner/settings/local_mysql.py index d2a63ff4..bfb78dd8 100644 --- a/volunteer_planner/settings/local_mysql.py +++ b/volunteer_planner/settings/local_mysql.py @@ -1,6 +1,6 @@ # coding: utf-8 -from volunteer_planner.settings.local import * +from .local import * # noqa: F401 DATABASES = { "default": { diff --git a/volunteer_planner/settings/local_postgres.py b/volunteer_planner/settings/local_postgres.py index 811da236..86ab5b58 100644 --- a/volunteer_planner/settings/local_postgres.py +++ b/volunteer_planner/settings/local_postgres.py @@ -1,6 +1,6 @@ # coding: utf-8 -from volunteer_planner.settings.local import * +from volunteer_planner.settings.local import * # noqa: F401 DATABASES = { "default": { diff --git a/volunteer_planner/settings/production.py b/volunteer_planner/settings/production.py index fdc981e9..fda060db 100644 --- a/volunteer_planner/settings/production.py +++ b/volunteer_planner/settings/production.py @@ -1,8 +1,9 @@ # coding=utf-8 -from .base import * from datetime import timedelta +from .base import * # noqa: F401 + DEBUG = os.environ.get("BETA", False) STATIC_ROOT = os.environ["STATIC_ROOT"] diff --git a/volunteer_planner/settings/tests.py b/volunteer_planner/settings/tests.py index aed1752d..fbef31c1 100644 --- a/volunteer_planner/settings/tests.py +++ b/volunteer_planner/settings/tests.py @@ -1,6 +1,7 @@ -from .local import * from datetime import timedelta +from .local import * # noqa: F401 + DEBUG = False # Needed for letting Selenium access our server. diff --git a/volunteer_planner/urls.py b/volunteer_planner/urls.py index 504f500d..40154bf1 100644 --- a/volunteer_planner/urls.py +++ b/volunteer_planner/urls.py @@ -1,8 +1,8 @@ # coding=utf-8 from django.conf import settings -from django.urls import include, re_path from django.contrib import admin from django.contrib.staticfiles.storage import staticfiles_storage +from django.urls import include, re_path from django.views.generic import RedirectView from content.views import translated_flatpage diff --git a/volunteer_planner/utils.py b/volunteer_planner/utils.py index 05772070..b6006608 100644 --- a/volunteer_planner/utils.py +++ b/volunteer_planner/utils.py @@ -1,8 +1,8 @@ # coding=utf-8 # codging: utf-8 -from django.utils.decorators import method_decorator from django.contrib.auth.decorators import login_required +from django.utils.decorators import method_decorator class LoginRequiredMixin(object): diff --git a/volunteer_planner/wsgi.py b/volunteer_planner/wsgi.py index 405e5077..ff97bae5 100644 --- a/volunteer_planner/wsgi.py +++ b/volunteer_planner/wsgi.py @@ -4,6 +4,7 @@ """ import os + from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "volunteer_planner.settings.production")