Commits

Bernardo Pires committed e0f108e Draft

get_item now uses the direct get method from a method and no longer calls get_queryset as the query on a primary key will always select maximum 1 element

  • Participants
  • Parent commits c1af6c9

Comments (0)

Files changed (1)

File selectable/base.py

         item = None
         if value:
             try:
-                item = self.get_queryset().filter(pk=value)[0]
-            except IndexError:
+                item = self.model.objects.get(pk=value)
+            except self.model.DoesNotExist:
                 pass
         return item