Code

Ticket #14567: queryset_none.patch

File queryset_none.patch, 566 bytes (added by melinath, 3 years ago)
  • django/forms/models.py

     
    10341034        if self.required and not value: 
    10351035            raise ValidationError(self.error_messages['required']) 
    10361036        elif not self.required and not value: 
    1037             return [] 
     1037            return self.queryset.none() 
    10381038        if not isinstance(value, (list, tuple)): 
    10391039            raise ValidationError(self.error_messages['list']) 
    10401040        for pk in value: