django__django-13112
makemigrations crashes for ForeignKey with mixed-case app name.
Verdict: the issue text repeats lines of the gold patch (Tier C).
Potential fix: diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py index d517d7269b..894d931d50 100644 --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -582,7 +582,8 @@ class ForeignObject(RelatedField): if self.remote_field.parent_link: kwargs['parent_link'] = self.remote_field.parent_link if isinstance(self.remote_field.model, str): - kwargs['to'] = self.remote_field.model.lower() + app_label, model_name = self.remote_field.model.split('.') + kwargs['to'] = '%s.%s' % (app_label, model_name.lower()) else: kwargs['to'] = self.remote_field.model._meta.label_lower # If swappable is True, then see if we're actually pointing to the target
3 of 4 added patch lines appear in the issue or discussion.
All SWE-bench Verified tasks · more django/django tasks · How the check works