Skip to content

Commit

Permalink
PB-1157 Add hreflang to django admin
Browse files Browse the repository at this point in the history
  • Loading branch information
schtibe committed Dec 5, 2024
1 parent eaa5499 commit 2821861
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/stac_api/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,17 @@ class ProviderInline(admin.TabularInline):
}


class CollectionLinkInline(admin.TabularInline):
class LinkInline(admin.TabularInline):

def formfield_for_dbfield(self, db_field, request, **kwargs):
# make the hreflang field a bit shorter
if db_field.attname == 'hreflang':
attrs = {'size': 10}
kwargs['widget'] = forms.TextInput(attrs=attrs)
return super().formfield_for_dbfield(db_field, request, **kwargs)


class CollectionLinkInline(LinkInline):
model = CollectionLink
extra = 0

Expand Down Expand Up @@ -154,7 +164,7 @@ def get_readonly_fields(self, request, obj=None):
return self.readonly_fields


class ItemLinkInline(admin.TabularInline):
class ItemLinkInline(LinkInline):
model = ItemLink
extra = 0

Expand Down

0 comments on commit 2821861

Please sign in to comment.