mirror of
https://github.com/django/django.git
synced 2025-12-23 09:19:27 +00:00
Refs #36438 -- Simplified retrieval of GeneratedField base fields in migrations autodetector.
This was creating an unusable Q object solely to call referenced_base_fields on it.
This commit is contained in:
parent
5ee651f255
commit
336e713e2a
1 changed files with 4 additions and 1 deletions
|
|
@ -1682,7 +1682,10 @@ class MigrationAutodetector:
|
|||
|
||||
def _get_dependencies_for_generated_field(self, field):
|
||||
dependencies = []
|
||||
referenced_base_fields = models.Q(field.expression).referenced_base_fields
|
||||
referenced_base_fields = [
|
||||
name
|
||||
for name, *lookups in models.Model._get_expr_references(field.expression)
|
||||
]
|
||||
newly_added_fields = sorted(self.new_field_keys - self.old_field_keys)
|
||||
for app_label, model_name, added_field_name in newly_added_fields:
|
||||
added_field = self.to_state.models[app_label, model_name].get_field(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue