From 2d4d8df1e8dca963077d05c3d27c8a9620ae428c Mon Sep 17 00:00:00 2001 From: Aman Yadav Date: Fri, 20 Dec 2019 10:23:17 +0200 Subject: [PATCH 1/2] Remove the load_data calls from the 0013 migration. It's Helsinki specific stuff and Parkkihubi's parkings app is aiming to be more general. --- parkings/migrations/0013_parking_terminal_data.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/parkings/migrations/0013_parking_terminal_data.py b/parkings/migrations/0013_parking_terminal_data.py index e216b49a..06b48975 100644 --- a/parkings/migrations/0013_parking_terminal_data.py +++ b/parkings/migrations/0013_parking_terminal_data.py @@ -4,11 +4,6 @@ from django.db import migrations -def load_parking_terminals_from_fixture(apps, schema_editor): - call_command('loaddata', 'parking_terminals', - verbosity=0) - - def noop(apps, schema_editor): pass @@ -19,7 +14,5 @@ class Migration(migrations.Migration): ] operations = [ - migrations.RunPython( - code=load_parking_terminals_from_fixture, - reverse_code=noop), + migrations.RunPython(code=noop, reverse_code=noop), ] From d7ce2e7a91eee4ce4ad6a845ad1818e6a055a3b7 Mon Sep 17 00:00:00 2001 From: Aman Yadav Date: Fri, 20 Dec 2019 10:21:32 +0200 Subject: [PATCH 2/2] Move Helsinki specific stuff to parkkihubi_hel --- parkkihubi/settings.py | 3 ++- parkkihubi_hel/__init__.py | 0 .../fixtures/parking_terminals.json | 0 {parkings => parkkihubi_hel}/importers/__init__.py | 0 .../importers/parking_areas.py | 2 +- .../importers/payment_zones.py | 0 .../importers/permit_areas.py | 0 {parkings => parkkihubi_hel}/importers/regions.py | 2 +- .../importers/wfs_importer.py | 0 parkkihubi_hel/management/__init__.py | 0 parkkihubi_hel/management/commands/__init__.py | 0 .../management/commands/import_parking_areas.py | 2 +- .../management/commands/import_payment_zones.py | 2 +- .../management/commands/import_permit_areas.py | 2 +- .../management/commands/import_regions.py | 0 parkkihubi_hel/tests/__init__.py | 0 .../tests/parking_area_importer_data.xml | 0 .../tests/payment_zone_importer_data.xml | 0 .../tests/permit_area_importer_data.xml | 0 .../tests/request_mocking.py | 0 .../tests/test-features.dbf | Bin .../tests/test-features.prj | 0 .../tests/test-features.shp | Bin .../tests/test-features.shx | Bin .../tests/test_importing_management_commands.py | 4 ++-- .../tests/test_parking_area_importer.py | 2 +- .../tests/test_payment_zone_importer.py | 2 +- .../tests/test_permit_area_importer.py | 2 +- .../tests/test_region_importer.py | 6 +++--- .../tests/wfs_capabilities_response.xml | 0 setup.cfg | 2 +- 31 files changed, 16 insertions(+), 15 deletions(-) create mode 100644 parkkihubi_hel/__init__.py rename {parkings => parkkihubi_hel}/fixtures/parking_terminals.json (100%) rename {parkings => parkkihubi_hel}/importers/__init__.py (100%) rename {parkings => parkkihubi_hel}/importers/parking_areas.py (98%) rename {parkings => parkkihubi_hel}/importers/payment_zones.py (100%) rename {parkings => parkkihubi_hel}/importers/permit_areas.py (100%) rename {parkings => parkkihubi_hel}/importers/regions.py (97%) rename {parkings => parkkihubi_hel}/importers/wfs_importer.py (100%) create mode 100644 parkkihubi_hel/management/__init__.py create mode 100644 parkkihubi_hel/management/commands/__init__.py rename {parkings => parkkihubi_hel}/management/commands/import_parking_areas.py (92%) rename {parkings => parkkihubi_hel}/management/commands/import_payment_zones.py (82%) rename {parkings => parkkihubi_hel}/management/commands/import_permit_areas.py (82%) rename {parkings => parkkihubi_hel}/management/commands/import_regions.py (100%) create mode 100644 parkkihubi_hel/tests/__init__.py rename {parkings => parkkihubi_hel}/tests/parking_area_importer_data.xml (100%) rename {parkings => parkkihubi_hel}/tests/payment_zone_importer_data.xml (100%) rename {parkings => parkkihubi_hel}/tests/permit_area_importer_data.xml (100%) rename {parkings => parkkihubi_hel}/tests/request_mocking.py (100%) rename {parkings => parkkihubi_hel}/tests/test-features.dbf (100%) rename {parkings => parkkihubi_hel}/tests/test-features.prj (100%) rename {parkings => parkkihubi_hel}/tests/test-features.shp (100%) rename {parkings => parkkihubi_hel}/tests/test-features.shx (100%) rename {parkings => parkkihubi_hel}/tests/test_importing_management_commands.py (94%) rename {parkings => parkkihubi_hel}/tests/test_parking_area_importer.py (92%) rename {parkings => parkkihubi_hel}/tests/test_payment_zone_importer.py (92%) rename {parkings => parkkihubi_hel}/tests/test_permit_area_importer.py (92%) rename {parkings => parkkihubi_hel}/tests/test_region_importer.py (94%) rename {parkings => parkkihubi_hel}/tests/wfs_capabilities_response.xml (100%) diff --git a/parkkihubi/settings.py b/parkkihubi/settings.py index eb4037d9..4a39f88b 100644 --- a/parkkihubi/settings.py +++ b/parkkihubi/settings.py @@ -80,7 +80,8 @@ 'parkkihubi', 'parkings', 'sanitized_dump', -] +] + env.list("EXTRA_INSTALLED_APPS", default=['parkkihubi_hel']) + if DEBUG and TIER == 'dev': # shell_plus and other goodies diff --git a/parkkihubi_hel/__init__.py b/parkkihubi_hel/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/parkings/fixtures/parking_terminals.json b/parkkihubi_hel/fixtures/parking_terminals.json similarity index 100% rename from parkings/fixtures/parking_terminals.json rename to parkkihubi_hel/fixtures/parking_terminals.json diff --git a/parkings/importers/__init__.py b/parkkihubi_hel/importers/__init__.py similarity index 100% rename from parkings/importers/__init__.py rename to parkkihubi_hel/importers/__init__.py diff --git a/parkings/importers/parking_areas.py b/parkkihubi_hel/importers/parking_areas.py similarity index 98% rename from parkings/importers/parking_areas.py rename to parkkihubi_hel/importers/parking_areas.py index 675b0cf8..189916ee 100644 --- a/parkings/importers/parking_areas.py +++ b/parkkihubi_hel/importers/parking_areas.py @@ -119,7 +119,7 @@ def _parse_member(self, member): dates start reflecting the individual members update time it would be a good way to see if a member needs updating or not. - There is an example file parkings/tests/parking_area_importer_data.xml + There is an example file tests/parking_area_importer_data.xml :param member: The member XML element. :returns: A dict containing the fields origin_id, capacity_estimate diff --git a/parkings/importers/payment_zones.py b/parkkihubi_hel/importers/payment_zones.py similarity index 100% rename from parkings/importers/payment_zones.py rename to parkkihubi_hel/importers/payment_zones.py diff --git a/parkings/importers/permit_areas.py b/parkkihubi_hel/importers/permit_areas.py similarity index 100% rename from parkings/importers/permit_areas.py rename to parkkihubi_hel/importers/permit_areas.py diff --git a/parkings/importers/regions.py b/parkkihubi_hel/importers/regions.py similarity index 97% rename from parkings/importers/regions.py rename to parkkihubi_hel/importers/regions.py index 450e6dce..24d2b433 100644 --- a/parkings/importers/regions.py +++ b/parkkihubi_hel/importers/regions.py @@ -3,7 +3,7 @@ from django.contrib.gis.gdal import DataSource from django.contrib.gis.utils import LayerMapping -from ..models import Region +from parkings.models import Region class ShapeFileToRegionImporter(object): diff --git a/parkings/importers/wfs_importer.py b/parkkihubi_hel/importers/wfs_importer.py similarity index 100% rename from parkings/importers/wfs_importer.py rename to parkkihubi_hel/importers/wfs_importer.py diff --git a/parkkihubi_hel/management/__init__.py b/parkkihubi_hel/management/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/parkkihubi_hel/management/commands/__init__.py b/parkkihubi_hel/management/commands/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/parkings/management/commands/import_parking_areas.py b/parkkihubi_hel/management/commands/import_parking_areas.py similarity index 92% rename from parkings/management/commands/import_parking_areas.py rename to parkkihubi_hel/management/commands/import_parking_areas.py index 8387fca1..1ca19af0 100755 --- a/parkings/management/commands/import_parking_areas.py +++ b/parkkihubi_hel/management/commands/import_parking_areas.py @@ -1,6 +1,6 @@ from django.core.management.base import BaseCommand -from parkings.importers import ParkingAreaImporter +from ...importers import ParkingAreaImporter class Command(BaseCommand): diff --git a/parkings/management/commands/import_payment_zones.py b/parkkihubi_hel/management/commands/import_payment_zones.py similarity index 82% rename from parkings/management/commands/import_payment_zones.py rename to parkkihubi_hel/management/commands/import_payment_zones.py index 44a1415c..7d52e93f 100644 --- a/parkings/management/commands/import_payment_zones.py +++ b/parkkihubi_hel/management/commands/import_payment_zones.py @@ -1,6 +1,6 @@ from django.core.management.base import BaseCommand -from parkings.importers import PaymentZoneImporter +from ...importers import PaymentZoneImporter class Command(BaseCommand): diff --git a/parkings/management/commands/import_permit_areas.py b/parkkihubi_hel/management/commands/import_permit_areas.py similarity index 82% rename from parkings/management/commands/import_permit_areas.py rename to parkkihubi_hel/management/commands/import_permit_areas.py index 0318efcc..d77ef9ae 100644 --- a/parkings/management/commands/import_permit_areas.py +++ b/parkkihubi_hel/management/commands/import_permit_areas.py @@ -1,6 +1,6 @@ from django.core.management.base import BaseCommand -from parkings.importers import PermitAreaImporter +from ...importers import PermitAreaImporter class Command(BaseCommand): diff --git a/parkings/management/commands/import_regions.py b/parkkihubi_hel/management/commands/import_regions.py similarity index 100% rename from parkings/management/commands/import_regions.py rename to parkkihubi_hel/management/commands/import_regions.py diff --git a/parkkihubi_hel/tests/__init__.py b/parkkihubi_hel/tests/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/parkings/tests/parking_area_importer_data.xml b/parkkihubi_hel/tests/parking_area_importer_data.xml similarity index 100% rename from parkings/tests/parking_area_importer_data.xml rename to parkkihubi_hel/tests/parking_area_importer_data.xml diff --git a/parkings/tests/payment_zone_importer_data.xml b/parkkihubi_hel/tests/payment_zone_importer_data.xml similarity index 100% rename from parkings/tests/payment_zone_importer_data.xml rename to parkkihubi_hel/tests/payment_zone_importer_data.xml diff --git a/parkings/tests/permit_area_importer_data.xml b/parkkihubi_hel/tests/permit_area_importer_data.xml similarity index 100% rename from parkings/tests/permit_area_importer_data.xml rename to parkkihubi_hel/tests/permit_area_importer_data.xml diff --git a/parkings/tests/request_mocking.py b/parkkihubi_hel/tests/request_mocking.py similarity index 100% rename from parkings/tests/request_mocking.py rename to parkkihubi_hel/tests/request_mocking.py diff --git a/parkings/tests/test-features.dbf b/parkkihubi_hel/tests/test-features.dbf similarity index 100% rename from parkings/tests/test-features.dbf rename to parkkihubi_hel/tests/test-features.dbf diff --git a/parkings/tests/test-features.prj b/parkkihubi_hel/tests/test-features.prj similarity index 100% rename from parkings/tests/test-features.prj rename to parkkihubi_hel/tests/test-features.prj diff --git a/parkings/tests/test-features.shp b/parkkihubi_hel/tests/test-features.shp similarity index 100% rename from parkings/tests/test-features.shp rename to parkkihubi_hel/tests/test-features.shp diff --git a/parkings/tests/test-features.shx b/parkkihubi_hel/tests/test-features.shx similarity index 100% rename from parkings/tests/test-features.shx rename to parkkihubi_hel/tests/test-features.shx diff --git a/parkings/tests/test_importing_management_commands.py b/parkkihubi_hel/tests/test_importing_management_commands.py similarity index 94% rename from parkings/tests/test_importing_management_commands.py rename to parkkihubi_hel/tests/test_importing_management_commands.py index 7ddd592b..a4813137 100644 --- a/parkings/tests/test_importing_management_commands.py +++ b/parkkihubi_hel/tests/test_importing_management_commands.py @@ -1,10 +1,10 @@ import pytest from django.core.management import call_command -from parkings.management.commands import ( - import_parking_areas, import_payment_zones, import_permit_areas) from parkings.models import ParkingArea, PaymentZone, PermitArea +from ..management.commands import ( + import_parking_areas, import_payment_zones, import_permit_areas) from .request_mocking import mocked_requests diff --git a/parkings/tests/test_parking_area_importer.py b/parkkihubi_hel/tests/test_parking_area_importer.py similarity index 92% rename from parkings/tests/test_parking_area_importer.py rename to parkkihubi_hel/tests/test_parking_area_importer.py index cb10111a..8caa153f 100644 --- a/parkings/tests/test_parking_area_importer.py +++ b/parkkihubi_hel/tests/test_parking_area_importer.py @@ -1,6 +1,6 @@ import os -from parkings.importers import ParkingAreaImporter +from ..importers import ParkingAreaImporter mydir = os.path.dirname(__file__) sample_xml_file = os.path.join(mydir, 'parking_area_importer_data.xml') diff --git a/parkings/tests/test_payment_zone_importer.py b/parkkihubi_hel/tests/test_payment_zone_importer.py similarity index 92% rename from parkings/tests/test_payment_zone_importer.py rename to parkkihubi_hel/tests/test_payment_zone_importer.py index 97e4f93b..0049d781 100644 --- a/parkings/tests/test_payment_zone_importer.py +++ b/parkkihubi_hel/tests/test_payment_zone_importer.py @@ -1,6 +1,6 @@ import os -from parkings.importers import PaymentZoneImporter +from ..importers import PaymentZoneImporter mydir = os.path.dirname(__file__) diff --git a/parkings/tests/test_permit_area_importer.py b/parkkihubi_hel/tests/test_permit_area_importer.py similarity index 92% rename from parkings/tests/test_permit_area_importer.py rename to parkkihubi_hel/tests/test_permit_area_importer.py index 606c21cf..968423fe 100644 --- a/parkings/tests/test_permit_area_importer.py +++ b/parkkihubi_hel/tests/test_permit_area_importer.py @@ -1,6 +1,6 @@ import os -from parkings.importers import PermitAreaImporter +from ..importers import PermitAreaImporter mydir = os.path.dirname(__file__) diff --git a/parkings/tests/test_region_importer.py b/parkkihubi_hel/tests/test_region_importer.py similarity index 94% rename from parkings/tests/test_region_importer.py rename to parkkihubi_hel/tests/test_region_importer.py index 4bd13136..0f979d73 100644 --- a/parkings/tests/test_region_importer.py +++ b/parkkihubi_hel/tests/test_region_importer.py @@ -2,11 +2,11 @@ import pytest -from parkings.importers.regions import ShapeFileToRegionImporter -from parkings.management.commands import import_regions from parkings.models import Region +from parkings.tests.utils import approx, call_mgmt_cmd_with_output -from .utils import approx, call_mgmt_cmd_with_output +from ..importers.regions import ShapeFileToRegionImporter +from ..management.commands import import_regions directory = os.path.abspath(os.path.dirname(__file__)) diff --git a/parkings/tests/wfs_capabilities_response.xml b/parkkihubi_hel/tests/wfs_capabilities_response.xml similarity index 100% rename from parkings/tests/wfs_capabilities_response.xml rename to parkkihubi_hel/tests/wfs_capabilities_response.xml diff --git a/setup.cfg b/setup.cfg index 92162dc5..deeeae38 100644 --- a/setup.cfg +++ b/setup.cfg @@ -23,7 +23,7 @@ filterwarnings = [isort] default_section=THIRDPARTY -known_first_party=parkkihubi,parkings +known_first_party=parkkihubi,parkings,parkkihubi_hel line_length=79 multi_line_output=4 not_skip=__init__.py