|
@@ -296,12 +296,6 @@ class ModelBase(type):
|
|
|
# Copy indexes so that index names are unique when models extend an
|
|
|
# abstract model.
|
|
|
new_class._meta.indexes = [copy.deepcopy(idx) for idx in new_class._meta.indexes]
|
|
|
- # Set the name of _meta.indexes. This can't be done in
|
|
|
- # Options.contribute_to_class() because fields haven't been added to
|
|
|
- # the model at that point.
|
|
|
- for index in new_class._meta.indexes:
|
|
|
- if not index.name:
|
|
|
- index.set_name_with_model(new_class)
|
|
|
|
|
|
if abstract:
|
|
|
# Abstract base models can't be instantiated and don't appear in
|
|
@@ -359,6 +353,13 @@ class ModelBase(type):
|
|
|
manager.auto_created = True
|
|
|
cls.add_to_class('objects', manager)
|
|
|
|
|
|
+ # Set the name of _meta.indexes. This can't be done in
|
|
|
+ # Options.contribute_to_class() because fields haven't been added to
|
|
|
+ # the model at that point.
|
|
|
+ for index in cls._meta.indexes:
|
|
|
+ if not index.name:
|
|
|
+ index.set_name_with_model(cls)
|
|
|
+
|
|
|
class_prepared.send(sender=cls)
|
|
|
|
|
|
@property
|