X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/a7c64b2ae44b54daac2d4bce4dc0c2d675e04504..341a4c1fd9b83f0289856986200fa5dd602047c9:/src/catalogue/admin.py?ds=sidebyside diff --git a/src/catalogue/admin.py b/src/catalogue/admin.py index 43ae8664..af083691 100644 --- a/src/catalogue/admin.py +++ b/src/catalogue/admin.py @@ -73,6 +73,20 @@ class WoblinkCatalogueWidget(forms.Select): ) return attrs + def optgroups(self, name, value, attrs=None): + """ Add synthetic option for keeping the current value. """ + return [(None, [ + self.create_option( + name, + v, + '(bez zmian)', + selected=True, + index=index, + attrs=attrs, + ) + for index, v in enumerate(value) + ], 0)] + class WoblinkAuthorWidget(WoblinkCatalogueWidget): category = 'author'