From dbe436a9a916fb2bab788d07e22e7a79577738b9 Mon Sep 17 00:00:00 2001 From: Jon Dufresne Date: Sun, 28 Apr 2019 22:54:32 -0700 Subject: [PATCH] Simplified Field.contribute_to_class(). --- django/db/models/fields/__init__.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 068b36a0b3..0c64748ccd 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -732,10 +732,7 @@ class Field(RegisterLookupMixin): """ self.set_attributes_from_name(name) self.model = cls - if private_only: - cls._meta.add_field(self, private=True) - else: - cls._meta.add_field(self) + cls._meta.add_field(self, private=private_only) if self.column: # Don't override classmethods with the descriptor. This means that # if you have a classmethod and a field with the same name, then