web/hdabo/forms.py
changeset 271 8f77cf71ab02
parent 265 73f19fa4f997
child 272 1c774f7a0341
--- a/web/hdabo/forms.py	Fri Nov 16 18:12:05 2012 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,14 +0,0 @@
-# -*- coding: utf-8 -*-
-from django import forms
-from django.db.models.query import QuerySet
-
-
-class SortedMultipleChoiceField(forms.ModelMultipleChoiceField):
-    def clean(self, value):
-        queryset = super(SortedMultipleChoiceField, self).clean(value)
-        if value is None or not isinstance(queryset, QuerySet):
-            return queryset
-        object_list = dict((
-            (unicode(key), value)
-            for key, value in queryset.in_bulk(value).iteritems()))
-        return [object_list[unicode(pk)] for pk in value]