Ticket #4787: ModelChoiceField_widget_choices.patch

File ModelChoiceField_widget_choices.patch, 682 bytes (added by fero <luca.ferroni@…>, 8 years ago)

Proposed patch

  • .py

    old new  
    142142        Field.__init__(self, required, widget, label, initial, help_text)
    143143        self.widget.choices = self.choices
    144144
     145    def _get_queryset(self):
     146        return self._queryset
     147
     148    def _set_queryset(self, value):
     149        self._queryset = value
     150        self.widget.choices = self.choices
     151
     152    queryset = property(_get_queryset, _set_queryset)
     153
    145154    def _get_choices(self):
    146155        # If self._choices is set, then somebody must have manually set
    147156        # the property self.choices. In this case, just return self._choices.
Back to Top