misc: drop support for django < 3.2 (#75681)
gitea/gadjo/pipeline/head There was a failure building this commit Details

This commit is contained in:
Frédéric Péters 2023-05-07 18:00:18 +02:00
parent 75f38ce67a
commit c222e234cf
1 changed files with 2 additions and 10 deletions

View File

@ -1,4 +1,3 @@
import django
from django import forms
@ -23,15 +22,8 @@ class MultiSelectWidget(forms.MultiWidget):
self.widgets.append(forms.Select(attrs=self.attrs, choices=self.choices))
# all subwidgets must have the same name
if django.VERSION >= (3, 1):
self.widgets_names = [''] * len(self.widgets)
return super().get_context(name, value, attrs)
else:
context = super().get_context(name, value, attrs)
subwidgets = context['widget']['subwidgets']
for widget in subwidgets:
widget['name'] = widget['name'].rsplit('_', 1)[0]
return context
self.widgets_names = [''] * len(self.widgets)
return super().get_context(name, value, attrs)
def decompress(self, value):
return value or []