X-Git-Url: https://git.mdrn.pl/redakcja.git/blobdiff_plain/a7c64b2ae44b54daac2d4bce4dc0c2d675e04504..14f2c24a604e36cad62ba9f6f8d71bf500f8e35a:/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'