Pre-fill year when adding edition
This commit is contained in:
parent
68d1bfc2b9
commit
55ff3cd1a9
|
@ -30,7 +30,7 @@
|
||||||
* added a new sort_name field that gets automatically created
|
* added a new sort_name field that gets automatically created
|
||||||
* automatically fill certain values in forms:
|
* automatically fill certain values in forms:
|
||||||
* new game: name and sort name after typing
|
* new game: name and sort name after typing
|
||||||
* new edition: name and sort name when selecting game
|
* new edition: name, sort name, and year when selecting game
|
||||||
* new purchase: platform when selecting edition
|
* new purchase: platform when selecting edition
|
||||||
|
|
||||||
## 1.3.0 / 2023-11-05 15:09+01:00
|
## 1.3.0 / 2023-11-05 15:09+01:00
|
||||||
|
|
|
@ -80,6 +80,7 @@ class IncludeNameSelect(forms.Select):
|
||||||
option = super().create_option(name, value, *args, **kwargs)
|
option = super().create_option(name, value, *args, **kwargs)
|
||||||
if value:
|
if value:
|
||||||
option["attrs"]["data-name"] = value.instance.name
|
option["attrs"]["data-name"] = value.instance.name
|
||||||
|
option["attrs"]["data-year"] = value.instance.year_released
|
||||||
return option
|
return option
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,12 @@ let syncData = [
|
||||||
"target": "#id_sort_name",
|
"target": "#id_sort_name",
|
||||||
"target_value": "value"
|
"target_value": "value"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"source": "#id_game",
|
||||||
|
"source_value": "dataset.year",
|
||||||
|
"target": "#id_year_released",
|
||||||
|
"target_value": "value"
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
syncSelectInputUntilChanged(syncData, "form");
|
syncSelectInputUntilChanged(syncData, "form");
|
||||||
|
|
Loading…
Reference in New Issue