diff options
| author | Taoup <mahongtao0x7e0@163.com> | 2020-01-07 09:34:15 +0800 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2020-01-07 11:58:06 +0100 |
| commit | 979f61abd322507aafced9627702362e541ec34e (patch) | |
| tree | 3f84bb4c6e929aeda9074d2276ecb1670d56d366 | |
| parent | 188b003014dc727ca22f7fafb21cf2fa0b3472d2 (diff) | |
Simplified model's Options.add_field() a bit.
| -rw-r--r-- | django/db/models/options.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/django/db/models/options.py b/django/db/models/options.py index baa0c875b2..a375f6ba1d 100644 --- a/django/db/models/options.py +++ b/django/db/models/options.py @@ -1,6 +1,6 @@ +import bisect import copy import inspect -from bisect import bisect from collections import defaultdict from django.apps import apps @@ -271,9 +271,9 @@ class Options: if private: self.private_fields.append(field) elif field.is_relation and field.many_to_many: - self.local_many_to_many.insert(bisect(self.local_many_to_many, field), field) + bisect.insort(self.local_many_to_many, field) else: - self.local_fields.insert(bisect(self.local_fields, field), field) + bisect.insort(self.local_fields, field) self.setup_pk(field) # If the field being added is a relation to another known field, |
