diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index d0a1324c798..f32ce646296 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -153,7 +153,7 @@ class Field(RegisterLookupMixin): self.unique_for_year = unique_for_year if isinstance(choices, collections.abc.Iterator): choices = list(choices) - self.choices = choices or [] + self.choices = choices self.help_text = help_text self.db_index = db_index self.db_column = db_column @@ -443,7 +443,7 @@ class Field(RegisterLookupMixin): "unique_for_date": None, "unique_for_month": None, "unique_for_year": None, - "choices": [], + "choices": None, "help_text": '', "db_column": None, "db_tablespace": None, @@ -598,7 +598,7 @@ class Field(RegisterLookupMixin): # Skip validation for non-editable fields. return - if self.choices and value not in self.empty_values: + if self.choices is not None and value not in self.empty_values: for option_key, option_value in self.choices: if isinstance(option_value, (list, tuple)): # This is an optgroup, so look inside the group for @@ -742,7 +742,7 @@ class Field(RegisterLookupMixin): # such fields can't be deferred (we don't have a check for this). if not getattr(cls, self.attname, None): setattr(cls, self.attname, DeferredAttribute(self.attname)) - if self.choices: + if self.choices is not None: setattr(cls, 'get_%s_display' % self.name, partialmethod(cls._get_FIELD_display, field=self)) @@ -812,7 +812,7 @@ class Field(RegisterLookupMixin): Return choices with a default blank choices included, for use as