Move sentry dependency to optional dependencies

Fixes #72
This commit is contained in:
Sonny Bakker 2021-01-17 21:26:20 +01:00
parent d2a1fd7f3a
commit 4496972205
3 changed files with 336 additions and 273 deletions

View file

@ -12,7 +12,14 @@ class RulesWidget(CheckboxSelectMultiple):
def create_option(self, *args, **kwargs):
option = super().create_option(*args, **kwargs)
instance = self.choices.queryset.get(pk=option["value"])
# see https://docs.djangoproject.com/en/3.1/releases/3.1/#id1
try:
pk = int(option["value"])
except TypeError:
pk = option["value"].value
instance = self.choices.queryset.get(pk=pk)
if self.category and instance.category:
option["selected"] = self.category.pk == instance.category.pk