When altering the given field, must constraints on its model from the given relation be temporarily dropped?
(relation, altered_field)
| 24 | |
| 25 | |
| 26 | def _is_relevant_relation(relation, altered_field): |
| 27 | """ |
| 28 | When altering the given field, must constraints on its model from the given |
| 29 | relation be temporarily dropped? |
| 30 | """ |
| 31 | field = relation.field |
| 32 | if field.many_to_many: |
| 33 | # M2M reverse field |
| 34 | return False |
| 35 | if altered_field.primary_key and field.to_fields == [None]: |
| 36 | # Foreign key constraint on the primary key, which is being altered. |
| 37 | return True |
| 38 | # Is the constraint targeting the field being altered? |
| 39 | return ( |
| 40 | altered_field.name in field.to_fields |
| 41 | or altered_field.attname in field.to_fields |
| 42 | ) |
| 43 | |
| 44 | |
| 45 | def _all_related_fields(model): |
no outgoing calls
no test coverage detected