X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/a7c64b2ae44b54daac2d4bce4dc0c2d675e04504..e6c778f6e92e584815a14d3e6a31a03a5e2ab7e1:/src/catalogue/admin.py 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'