Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test of changing app folder without database change #456

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
2 changes: 1 addition & 1 deletion caps/admin.py → cape/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.contrib import admin

from caps.models import Council, PlanDocument, DataType, DataPoint
from cape.models import Council, PlanDocument, DataType, DataPoint


class CouncilAdmin(admin.ModelAdmin):
Expand Down
2 changes: 1 addition & 1 deletion caps/api/routers.py → cape/api/routers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from caps.api.views import APIView
from cape.api.views import APIView
from rest_framework import routers


Expand Down
2 changes: 1 addition & 1 deletion caps/api/serializers.py → cape/api/serializers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from caps.models import Council, SavedSearch, Promise
from cape.models import Council, SavedSearch, Promise
from rest_framework import serializers, reverse


Expand Down
4 changes: 2 additions & 2 deletions caps/api/views.py → cape/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
from rest_framework.exceptions import APIException
from rest_framework.pagination import PageNumberPagination

from caps.models import Council, SavedSearch, PlanDocument, Promise
from caps.api.serializers import (
from cape.models import Council, SavedSearch, PlanDocument, Promise
from cape.api.serializers import (
CouncilSerializer,
SearchTermSerializer,
PromiseSerializer,
Expand Down
3 changes: 2 additions & 1 deletion caps/apps.py → cape/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@


class CapsConfig(AppConfig):
name = "caps"
name = "cape"
label = "caps"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion caps/forms.py → cape/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from haystack.query import SearchQuerySet
from haystack.inputs import Exact

from caps.models import Distance, ComparisonType, Council
from cape.models import Distance, ComparisonType, Council


class HighlightedSearchForm(SearchForm):
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from django.conf import settings


from caps.import_utils import (
from cape.import_utils import (
get_data_files,
add_extra_authority_info,
add_authority_codes,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from pathlib import Path

import requests
from caps.models import (
from cape.models import (
ComparisonLabel,
ComparisonLabelAssignment,
ComparisonType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings

from caps.models import PlanDocument
from cape.models import PlanDocument


def generate_text(pdf_path, df, index):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import math
import zipfile

from caps.models import Council, PlanDocument
from cape.models import Council, PlanDocument

from django.core.management.base import BaseCommand, CommandError
from django.core.files import File
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.core.management.base import BaseCommand
from django.conf import settings

from caps.import_utils import (
from cape.import_utils import (
add_authority_codes,
add_gss_codes,
get_google_sheet_as_csv,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import ssl

from caps.import_utils import add_authority_codes
from cape.import_utils import add_authority_codes

BASE_URL = "https://sustainablescotlandnetwork.org/"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.conf import settings
from django.db import transaction

from caps.models import Council, CouncilProject
from cape.models import Council, CouncilProject


class Command(BaseCommand):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

from django.db.models import F

from caps.models import Tag, CouncilTag, Council
from cape.models import Tag, CouncilTag, Council
from scoring.models import PlanSectionScore, PlanScore, PlanQuestionScore
from caps.import_utils import get_google_sheet_as_csv, replace_csv_headers
from cape.import_utils import get_google_sheet_as_csv, replace_csv_headers


def get_tags():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from django.conf import settings
from django.db import transaction

from caps.models import Council, EmergencyDeclaration
from caps.utils import char_from_text, date_from_text
from caps.import_utils import (
from cape.models import Council, EmergencyDeclaration
from cape.utils import char_from_text, date_from_text
from cape.import_utils import (
add_authority_codes,
add_gss_codes,
get_google_sheet_as_csv,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Import local authority_emissions
"""
import pandas as pd
from caps.models import Council, DataPoint, DataType
from cape.models import Council, DataPoint, DataType
from django.core.management.base import BaseCommand
from django.db.models import Count
from mysoc_dataset import get_dataset_url
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from os.path import join

from scoring.models import PlanScore
from caps.models import PlanDocument
from cape.models import PlanDocument

FILTER_DATA_URL = "https://raw.githubusercontent.com/mysociety/climate_league_filter_datasets/main/data/outputs/all_filters.csv"
FILTER_CSV = join(settings.DATA_DIR, "all_filters.csv")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

import pandas as pd

from caps.models import Council, PlanDocument
from caps.utils import (
from cape.models import Council, PlanDocument
from cape.utils import (
boolean_from_text,
char_from_text,
date_from_text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from django.conf import settings
from django.db import transaction

from caps.models import Council, PlanDocument, Promise
from caps.import_utils import add_authority_codes, add_gss_codes
from caps.utils import char_from_text
from cape.models import Council, PlanDocument, Promise
from cape.import_utils import add_authority_codes, add_gss_codes
from cape.utils import char_from_text

"""
Wrap this in a transaction and delete all the things as it makes more sense
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import pandas as pd

from caps.models import Council
from cape.models import Council

# Download file link from https://geoportal.statistics.gov.uk/datasets/local-authority-district-to-combined-authority-december-2019-lookup-in-england
COMBINED_AUTHORITY_MAPPING_URL = "https://prod-hub-indexer.s3.amazonaws.com/files/db4f8bae6bfa41babfafea3ec8a38c0e/0/full/4326/db4f8bae6bfa41babfafea3ec8a38c0e_0_full_4326.csv"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings

from caps.models import PlanDocument
from cape.models import PlanDocument


def remove_internal_data():
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
from django.core.management.base import BaseCommand, CommandError
from django.conf import settings

from caps.models import PlanDocument
from caps.import_utils import get_google_sheet_as_csv, replace_csv_headers
from cape.models import PlanDocument
from cape.import_utils import get_google_sheet_as_csv, replace_csv_headers

import ssl

Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by Django 2.2.8 on 2020-10-23 16:41

import caps.models
import cape.models
from django.db import migrations, models


Expand All @@ -20,6 +20,6 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='plandocument',
name='file',
field=models.FileField(storage=caps.models.OverwriteStorage(), upload_to='', verbose_name='plans'),
field=models.FileField(storage=cape.models.OverwriteStorage(), upload_to='', verbose_name='plans'),
),
]
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion caps/models.py → cape/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from django.forms import Select, TextInput
from django.utils.text import slugify
from simple_history.models import HistoricalRecords
from caps.filters import DefaultSecondarySortFilter
from cape.filters import DefaultSecondarySortFilter


def query_lookup(
Expand Down
2 changes: 1 addition & 1 deletion caps/search_indexes.py → cape/search_indexes.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from haystack import indexes
from caps.models import PlanDocument
from cape.models import PlanDocument
from django.utils.html import strip_tags


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from django import template
from django.template.defaultfilters import stringfilter

from caps.models import PlanDocument
from cape.models import PlanDocument

register = template.Library()

Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion caps/tests/test_api.py → cape/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from datetime import datetime, date

from rest_framework.test import APITestCase
from caps.models import Council, PlanDocument, SavedSearch, Promise
from cape.models import Council, PlanDocument, SavedSearch, Promise


class CouncilsAPITestCase(APITestCase):
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions caps/tests/test_import.py → cape/tests/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import unittest
from django.core.management import call_command
from caps.models import Council, PlanDocument, Promise, Tag, CouncilTag
from cape.models import Council, PlanDocument, Promise, Tag, CouncilTag

from caps.management.commands.import_council_tags import (
from cape.management.commands.import_council_tags import (
create_tags,
create_council_tags,
)
Expand Down
4 changes: 2 additions & 2 deletions caps/tests/test_mapit.py → cape/tests/test_mapit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

from unittest.mock import patch

from caps.models import Council
from cape.models import Council

from caps.mapit import (
from cape.mapit import (
MapIt,
NotFoundException,
BadRequestException,
Expand Down
4 changes: 2 additions & 2 deletions caps/tests/test_models.py → cape/tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from django.test import TestCase

from caps.models import Council, PlanDocument, SavedSearch
from caps.utils import boolean_from_text
from cape.models import Council, PlanDocument, SavedSearch
from cape.utils import boolean_from_text


class PlanDocumentStartEndEndYearsFromTimePeriodTestCase(TestCase):
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion caps/tests/test_views.py → cape/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from django.urls import reverse

from caps.models import Council, Promise, PlanDocument, EmergencyDeclaration
from cape.models import Council, Promise, PlanDocument, EmergencyDeclaration


class TestPageRenders(TestCase):
Expand Down
8 changes: 4 additions & 4 deletions caps/urls.py → cape/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
from django.conf import settings

import haystack.generic_views
from caps.forms import HighlightedSearchForm
import caps.views as views
import caps.api.views as api_views
from caps.api import routers
from cape.forms import HighlightedSearchForm
import cape.views as views
import cape.api.views as api_views
from cape.api import routers

router = routers.Router()
router.register(r"councils", api_views.CouncilViewSet, basename="council")
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions caps/views.py → cape/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from django_filters.views import FilterView
from haystack.generic_views import SearchView as HaystackSearchView

from caps.models import (
from cape.models import (
Council,
CouncilFilter,
PlanDocument,
Expand All @@ -28,20 +28,20 @@
CouncilProject,
ProjectFilter,
)
from caps.forms import HighlightedSearchForm
from caps.mapit import (
from cape.forms import HighlightedSearchForm
from cape.mapit import (
MapIt,
NotFoundException,
BadRequestException,
InternalServerErrorException,
ForbiddenException,
)

import caps.charts as charts
import cape.charts as charts

from charting import ChartCollection

from caps.utils import file_size, is_valid_postcode
from cape.utils import file_size, is_valid_postcode

from scoring.models import (
PlanScore,
Expand Down
6 changes: 3 additions & 3 deletions proj/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"django.template.context_processors.static",
"django.template.context_processors.tz",
"django.contrib.messages.context_processors.messages",
"caps.context_processors.analytics",
"cape.context_processors.analytics",
],
},
},
Expand Down Expand Up @@ -107,7 +107,7 @@
PIPELINE = {
"STYLESHEETS": {
"caps": {
"source_filenames": ("caps/scss/main.scss",),
"source_filenames": ("cape/scss/main.scss",),
"output_filename": "css/caps.css",
},
"scoring": {
Expand Down Expand Up @@ -184,7 +184,7 @@
"bootstrap4",
"rest_framework",
"simple_history",
"caps",
"cape",
"scoring",
"charting",
]
Expand Down
2 changes: 1 addition & 1 deletion proj/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
urlpatterns = static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

urlpatterns += [
path("", include("caps.urls")),
path("", include("cape.urls")),
]
2 changes: 1 addition & 1 deletion scoring/filters.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import django_filters

from caps.models import Council
from cape.models import Council
from scoring.models import PlanScore, PlanQuestionScore


Expand Down
2 changes: 1 addition & 1 deletion scoring/management/commands/fetch_and_import_plan_urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.conf import settings
from django.db import transaction

from caps.import_utils import get_google_sheet_as_csv
from cape.import_utils import get_google_sheet_as_csv

from scoring.models import PlanScore, PlanScoreDocument

Expand Down
Loading