Optimized Field.deconstruct() by using elif.

This commit is contained in:
Mads Jensen 2019-08-14 10:50:31 +02:00 committed by Mariusz Felisiak
parent eed2e740f7
commit 0b8d911d28
1 changed files with 3 additions and 3 deletions

View File

@ -477,11 +477,11 @@ class Field(RegisterLookupMixin):
path = "%s.%s" % (self.__class__.__module__, self.__class__.__qualname__)
if path.startswith("django.db.models.fields.related"):
path = path.replace("django.db.models.fields.related", "django.db.models")
if path.startswith("django.db.models.fields.files"):
elif path.startswith("django.db.models.fields.files"):
path = path.replace("django.db.models.fields.files", "django.db.models")
if path.startswith("django.db.models.fields.proxy"):
elif path.startswith("django.db.models.fields.proxy"):
path = path.replace("django.db.models.fields.proxy", "django.db.models")
if path.startswith("django.db.models.fields"):
elif path.startswith("django.db.models.fields"):
path = path.replace("django.db.models.fields", "django.db.models")
# Return basic info - other fields should override this.
return (self.name, path, [], keywords)