Skip to content

Commit

Permalink
Merge pull request #436 from geoadmin/feat-pb-851-inline-collection-a…
Browse files Browse the repository at this point in the history
…ssets

PB-851 Inline the collection assets to collection in admin
  • Loading branch information
schtibe authored Jul 30, 2024
2 parents 2f49b55 + aee9c58 commit 7735e5b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 6 additions & 1 deletion app/stac_api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ class CollectionLinkInline(admin.TabularInline):
extra = 0


class CollectionAssetInline(admin.StackedInline):
model = CollectionAsset
extra = 0


@admin.register(Collection)
class CollectionAdmin(admin.ModelAdmin):

Expand Down Expand Up @@ -110,7 +115,7 @@ class Media:
'etag',
'update_interval'
]
inlines = [ProviderInline, CollectionLinkInline]
inlines = [ProviderInline, CollectionLinkInline, CollectionAssetInline]
search_fields = ['name']
list_display = ['name', 'published']
list_filter = ['published']
Expand Down
6 changes: 5 additions & 1 deletion app/tests/test_admin_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ def _create_collection(self, with_link=False, with_provider=False, extra=None):
"providers-TOTAL_FORMS": "0",
"providers-INITIAL_FORMS": "0",
"links-TOTAL_FORMS": "0",
"links-INITIAL_FORMS": "0"
"links-INITIAL_FORMS": "0",
"assets-TOTAL_FORMS": "0",
"assets-INITIAL_FORMS": "0"
}
if with_link:
data.update({
Expand Down Expand Up @@ -416,6 +418,8 @@ def test_add_collection_with_provider_empty_description(self):
"providers-0-description": "",
"providers-0-roles": "licensor",
"providers-0-url": "http://www.example.com",
"assets-TOTAL_FORMS": "0",
"assets-INITIAL_FORMS": "0"
}
response = self.client.post("/api/stac/admin/stac_api/collection/add/", data)

Expand Down

0 comments on commit 7735e5b

Please sign in to comment.