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

PB-1169 Search forecast properties #500

Merged
merged 8 commits into from
Jan 27, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Refactor models - move file
Move models file into folder /models and rename file to general.py.
Fix all imports that referenced the models file.
benschs committed Jan 27, 2025
commit 18d698be3a0d3d716e979e6816162484fa6b56cf
22 changes: 11 additions & 11 deletions app/stac_api/admin.py
Original file line number Diff line number Diff line change
@@ -17,17 +17,17 @@
from django.urls import reverse
from django.utils.translation import gettext_lazy as _

from stac_api.models import BBOX_CH
from stac_api.models import Asset
from stac_api.models import AssetUpload
from stac_api.models import Collection
from stac_api.models import CollectionAsset
from stac_api.models import CollectionLink
from stac_api.models import Item
from stac_api.models import ItemLink
from stac_api.models import LandingPage
from stac_api.models import LandingPageLink
from stac_api.models import Provider
from stac_api.models.general import BBOX_CH
from stac_api.models.general import Asset
from stac_api.models.general import AssetUpload
from stac_api.models.general import Collection
from stac_api.models.general import CollectionAsset
from stac_api.models.general import CollectionLink
from stac_api.models.general import Item
from stac_api.models.general import ItemLink
from stac_api.models.general import LandingPage
from stac_api.models.general import LandingPageLink
from stac_api.models.general import Provider
from stac_api.utils import build_asset_href
from stac_api.utils import get_query_params
from stac_api.validators import validate_href_url
2 changes: 1 addition & 1 deletion app/stac_api/management/commands/calculate_extent.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
from django.core.management.base import CommandParser
from django.db import connection

from stac_api.models import Collection
from stac_api.models.general import Collection
from stac_api.utils import CommandHandler
from stac_api.utils import CustomBaseCommand

6 changes: 3 additions & 3 deletions app/stac_api/management/commands/dummy_asset_upload.py
Original file line number Diff line number Diff line change
@@ -4,9 +4,9 @@
from django.conf import settings
from django.core.management.base import BaseCommand

from stac_api.models import Asset
from stac_api.models import AssetUpload
from stac_api.models import BaseAssetUpload
from stac_api.models.general import Asset
from stac_api.models.general import AssetUpload
from stac_api.models.general import BaseAssetUpload
from stac_api.s3_multipart_upload import MultipartUpload
from stac_api.utils import AVAILABLE_S3_BUCKETS
from stac_api.utils import CommandHandler
6 changes: 3 additions & 3 deletions app/stac_api/management/commands/dummy_data.py
Original file line number Diff line number Diff line change
@@ -13,9 +13,9 @@
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.management.base import BaseCommand

from stac_api.models import Asset
from stac_api.models import Collection
from stac_api.models import Item
from stac_api.models.general import Asset
from stac_api.models.general import Collection
from stac_api.models.general import Item
from stac_api.utils import CommandHandler
from stac_api.validators import MEDIA_TYPES

2 changes: 1 addition & 1 deletion app/stac_api/management/commands/list_asset_uploads.py
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
from django.core.management.base import BaseCommand
from django.core.serializers.json import DjangoJSONEncoder

from stac_api.models import AssetUpload
from stac_api.models.general import AssetUpload
from stac_api.s3_multipart_upload import MultipartUpload
from stac_api.serializers.upload import AssetUploadSerializer
from stac_api.utils import CommandHandler
Original file line number Diff line number Diff line change
@@ -10,7 +10,7 @@
from rest_framework.request import Request
from rest_framework.test import APIRequestFactory

from stac_api.models import Item
from stac_api.models.general import Item
from stac_api.utils import CommandHandler

logger = logging.getLogger(__name__)
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@

from rest_framework.test import APIRequestFactory

from stac_api.models import Item
from stac_api.models.general import Item
from stac_api.utils import CommandHandler

logger = logging.getLogger(__name__)
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@

from rest_framework.test import APIRequestFactory

from stac_api.models import Item
from stac_api.models.general import Item
from stac_api.utils import CommandHandler

logger = logging.getLogger(__name__)
6 changes: 3 additions & 3 deletions app/stac_api/management/commands/remove_expired_items.py
Original file line number Diff line number Diff line change
@@ -4,9 +4,9 @@
from django.core.management.base import CommandParser
from django.utils import timezone

from stac_api.models import AssetUpload
from stac_api.models import BaseAssetUpload
from stac_api.models import Item
from stac_api.models.general import AssetUpload
from stac_api.models.general import BaseAssetUpload
from stac_api.models.general import Item
from stac_api.utils import CommandHandler
from stac_api.utils import CustomBaseCommand

4 changes: 2 additions & 2 deletions app/stac_api/management/commands/update_asset_file_size.py
Original file line number Diff line number Diff line change
@@ -6,8 +6,8 @@
from django.core.management.base import BaseCommand
from django.core.management.base import CommandParser

from stac_api.models import Asset
from stac_api.models import CollectionAsset
from stac_api.models.general import Asset
from stac_api.models.general import CollectionAsset
from stac_api.utils import CommandHandler
from stac_api.utils import get_s3_client
from stac_api.utils import select_s3_bucket
8 changes: 4 additions & 4 deletions app/stac_api/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
from django.db import migrations
from django.db import models

import stac_api.models
import stac_api.models.general
import stac_api.validators


@@ -74,7 +74,7 @@ class Migration(migrations.Migration):
(
'summaries',
models.JSONField(
default=stac_api.models.get_default_summaries_value,
default=stac_api.models.general.get_default_summaries_value,
editable=False,
encoder=django.core.serializers.json.DjangoJSONEncoder
)
@@ -102,7 +102,7 @@ class Migration(migrations.Migration):
'conformsTo',
django.contrib.postgres.fields.ArrayField(
base_field=models.URLField(),
default=stac_api.models.get_conformance_default_links,
default=stac_api.models.general.get_conformance_default_links,
help_text='Comma-separated list of URLs for the value conformsTo',
size=None
)
@@ -335,7 +335,7 @@ class Migration(migrations.Migration):
(
'file',
models.FileField(
max_length=255, upload_to=stac_api.models.upload_asset_to_path_hook
max_length=255, upload_to=stac_api.models.general.upload_asset_to_path_hook
)
),
(
7 changes: 5 additions & 2 deletions app/stac_api/migrations/0005_auto_20210408_0821.py
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
from django.db import migrations
from django.db import models

import stac_api.models
import stac_api.models.general


class Migration(migrations.Migration):
@@ -50,7 +50,10 @@ class Migration(migrations.Migration):
('created', models.DateTimeField(auto_now_add=True)),
('ended', models.DateTimeField(blank=True, default=None, null=True)),
('checksum_multihash', models.CharField(max_length=255)),
('etag', models.CharField(default=stac_api.models.compute_etag, max_length=56)),
(
'etag',
models.CharField(default=stac_api.models.general.compute_etag, max_length=56)
),
(
'asset',
models.ForeignKey(
8 changes: 4 additions & 4 deletions app/stac_api/migrations/0014_auto_20210715_1358.py
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@
from django.db import migrations
from django.db import models

import stac_api.models
import stac_api.models.general


class Migration(migrations.Migration):
@@ -49,7 +49,7 @@ class Migration(migrations.Migration):
model_name='asset',
name='etag',
field=models.CharField(
default=stac_api.models.compute_etag, editable=False, max_length=56
default=stac_api.models.general.compute_etag, editable=False, max_length=56
),
),
migrations.AlterField(
@@ -61,7 +61,7 @@ class Migration(migrations.Migration):
model_name='collection',
name='etag',
field=models.CharField(
default=stac_api.models.compute_etag, editable=False, max_length=56
default=stac_api.models.general.compute_etag, editable=False, max_length=56
),
),
migrations.AlterField(
@@ -89,7 +89,7 @@ class Migration(migrations.Migration):
model_name='item',
name='etag',
field=models.CharField(
default=stac_api.models.compute_etag, editable=False, max_length=56
default=stac_api.models.general.compute_etag, editable=False, max_length=56
),
),
migrations.AlterField(
6 changes: 3 additions & 3 deletions app/stac_api/migrations/0032_alter_asset_file.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

from django.db import migrations

import stac_api.models
import stac_api.models.general


class Migration(migrations.Migration):
@@ -15,8 +15,8 @@ class Migration(migrations.Migration):
migrations.AlterField(
model_name='asset',
name='file',
field=stac_api.models.DynamicStorageFileField(
max_length=255, upload_to=stac_api.models.upload_asset_to_path_hook
field=stac_api.models.general.DynamicStorageFileField(
max_length=255, upload_to=stac_api.models.general.upload_asset_to_path_hook
),
),
]
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@
from django.db import migrations
from django.db import models

import stac_api.models
import stac_api.models.general
import stac_api.validators


@@ -21,7 +21,7 @@ class Migration(migrations.Migration):
name='conformsTo',
field=django.contrib.postgres.fields.ArrayField(
base_field=models.URLField(),
default=stac_api.models.get_conformance_default_links,
default=stac_api.models.general.get_conformance_default_links,
help_text='Comma-separated list of URLs for the value conformsTo',
size=None
),
8 changes: 4 additions & 4 deletions app/stac_api/migrations/0036_collectionasset_and_more.py
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
from django.db import migrations
from django.db import models

import stac_api.models
import stac_api.models.general
import stac_api.validators


@@ -34,8 +34,8 @@ class Migration(migrations.Migration):
),
(
'file',
stac_api.models.DynamicStorageFileField(
max_length=255, upload_to=stac_api.models.upload_asset_to_path_hook
stac_api.models.general.DynamicStorageFileField(
max_length=255, upload_to=stac_api.models.general.upload_asset_to_path_hook
)
),
(
@@ -192,7 +192,7 @@ class Migration(migrations.Migration):
(
'etag',
models.CharField(
default=stac_api.models.compute_etag, editable=False, max_length=56
default=stac_api.models.general.compute_etag, editable=False, max_length=56
)
),
(
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
from django.db import migrations
from django.db import models

import stac_api.models
import stac_api.models.general


class Migration(migrations.Migration):
@@ -69,7 +69,10 @@ class Migration(migrations.Migration):
('created', models.DateTimeField(auto_now_add=True)),
('ended', models.DateTimeField(blank=True, default=None, null=True)),
('checksum_multihash', models.CharField(max_length=255)),
('etag', models.CharField(default=stac_api.models.compute_etag, max_length=56)),
(
'etag',
models.CharField(default=stac_api.models.general.compute_etag, max_length=56)
),
(
'update_interval',
models.IntegerField(
Empty file added app/stac_api/models/__init__.py
Empty file.
File renamed without changes.
4 changes: 2 additions & 2 deletions app/stac_api/s3_multipart_upload.py
Original file line number Diff line number Diff line change
@@ -12,8 +12,8 @@
from rest_framework import serializers

from stac_api.exceptions import UploadNotInProgressError
from stac_api.models import Asset
from stac_api.models import CollectionAsset
from stac_api.models.general import Asset
from stac_api.models.general import CollectionAsset
from stac_api.utils import AVAILABLE_S3_BUCKETS
from stac_api.utils import get_s3_cache_control_value
from stac_api.utils import get_s3_client
10 changes: 5 additions & 5 deletions app/stac_api/sample_data/importer.py
Original file line number Diff line number Diff line change
@@ -9,11 +9,11 @@
from django.contrib.gis.geos import GEOSGeometry
from django.core.files.uploadedfile import SimpleUploadedFile

from stac_api.models import Asset
from stac_api.models import Collection
from stac_api.models import CollectionLink
from stac_api.models import Item
from stac_api.models import Provider
from stac_api.models.general import Asset
from stac_api.models.general import Collection
from stac_api.models.general import CollectionLink
from stac_api.models.general import Item
from stac_api.models.general import Provider

# path definition relative to the directory that contains manage.py
DATADIR = settings.BASE_DIR / 'app/stac_api/management/sample_data/'
8 changes: 4 additions & 4 deletions app/stac_api/serializers/collection.py
Original file line number Diff line number Diff line change
@@ -4,10 +4,10 @@

from rest_framework import serializers

from stac_api.models import Collection
from stac_api.models import CollectionAsset
from stac_api.models import CollectionLink
from stac_api.models import Provider
from stac_api.models.general import Collection
from stac_api.models.general import CollectionAsset
from stac_api.models.general import CollectionLink
from stac_api.models.general import Provider
from stac_api.serializers.utils import AssetsDictSerializer
from stac_api.serializers.utils import HrefField
from stac_api.serializers.utils import NonNullModelSerializer
4 changes: 2 additions & 2 deletions app/stac_api/serializers/general.py
Original file line number Diff line number Diff line change
@@ -8,8 +8,8 @@
from rest_framework import serializers
from rest_framework.validators import UniqueValidator

from stac_api.models import LandingPage
from stac_api.models import LandingPageLink
from stac_api.models.general import LandingPage
from stac_api.models.general import LandingPageLink
from stac_api.utils import get_browser_url
from stac_api.utils import get_stac_version
from stac_api.utils import get_url
6 changes: 3 additions & 3 deletions app/stac_api/serializers/item.py
Original file line number Diff line number Diff line change
@@ -8,9 +8,9 @@
from rest_framework import serializers
from rest_framework_gis import serializers as gis_serializers

from stac_api.models import Asset
from stac_api.models import Item
from stac_api.models import ItemLink
from stac_api.models.general import Asset
from stac_api.models.general import Item
from stac_api.models.general import ItemLink
from stac_api.serializers.utils import AssetsDictSerializer
from stac_api.serializers.utils import HrefField
from stac_api.serializers.utils import IsoDurationField
4 changes: 2 additions & 2 deletions app/stac_api/serializers/upload.py
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@
from rest_framework import serializers
from rest_framework.utils.serializer_helpers import ReturnDict

from stac_api.models import AssetUpload
from stac_api.models import CollectionAssetUpload
from stac_api.models.general import AssetUpload
from stac_api.models.general import CollectionAssetUpload
from stac_api.serializers.utils import NonNullModelSerializer
from stac_api.utils import is_api_version_1
from stac_api.utils import isoformat
6 changes: 3 additions & 3 deletions app/stac_api/serializers/utils.py
Original file line number Diff line number Diff line change
@@ -10,9 +10,9 @@
from rest_framework import serializers
from rest_framework.utils.serializer_helpers import ReturnDict

from stac_api.models import Collection
from stac_api.models import Item
from stac_api.models import Link
from stac_api.models.general import Collection
from stac_api.models.general import Item
from stac_api.models.general import Link
from stac_api.utils import build_asset_href
from stac_api.utils import get_browser_url
from stac_api.utils import get_url
Loading