Pre-fill year when adding edition

This commit is contained in:
2023-11-09 15:20:30 +01:00
parent a879360ebd
commit 099d989f16
3 changed files with 8 additions and 1 deletions

View File

@ -80,6 +80,7 @@ class IncludeNameSelect(forms.Select):
option = super().create_option(name, value, *args, **kwargs)
if value:
option["attrs"]["data-name"] = value.instance.name
option["attrs"]["data-year"] = value.instance.year_released
return option

View File

@ -13,6 +13,12 @@ let syncData = [
"target": "#id_sort_name",
"target_value": "value"
},
{
"source": "#id_game",
"source_value": "dataset.year",
"target": "#id_year_released",
"target_value": "value"
},
]
syncSelectInputUntilChanged(syncData, "form");