Skip to content

Commit ba87a62

Browse files
authored
Update metadata admin form (#6731)
1 parent 3048b7e commit ba87a62

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

kitsune/products/admin.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def to_python(self, value):
2525
return result
2626

2727

28-
class TopicAdminForm(forms.ModelForm):
29-
metadata = DictOnlyJSONField(required=False)
28+
class MetadataForm(forms.ModelForm):
29+
metadata = DictOnlyJSONField(required=False, initial=dict)
3030

3131
class Meta:
3232
model = Topic
@@ -67,6 +67,7 @@ class ProductAdmin(admin.ModelAdmin):
6767
readonly_fields = ("id",)
6868
prepopulated_fields = {"slug": ("title",)}
6969
list_filter = (ArchivedFilter,)
70+
form = MetadataForm
7071

7172
def changelist_view(self, request, extra_context=None):
7273
if "is_archived" not in request.GET:
@@ -90,7 +91,7 @@ def parent(obj):
9091
def get_products(obj):
9192
return ", ".join([p.title for p in obj.products.all()])
9293

93-
form = TopicAdminForm
94+
form = MetadataForm
9495

9596
parent.short_description = "Parent" # type: ignore
9697
get_products.short_description = "Products" # type: ignore

0 commit comments

Comments
 (0)