#28056: Reverse migration for model rename with cross-app ForeignKey fails
------------------------------+------------------------------------
Reporter: Paul Tiplady | Owner: Bhuvnesh
Type: Bug | Status: assigned
Component: Migrations | Version: 1.10
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
------------------------------+------------------------------------
Comment (by Bhuvnesh):
There seems to be some problem with this ticket, I wasn't able to
reproduce with django v1.10.7 as described above. I played with the sample
repo provided and observed that the error :
{{{ValueError: The field two.Related2.rename1 was declared with a lazy
reference to 'one.rename1', but app 'one' doesn't provide model
'rename1'.}}}
is produced when we run makemigrations command again after the RenameModel
migration file is generated. I think at that time django didn't had the
functionality to rename the cross-app referenced models, we can solve this
by editing the migration file two.0001_initial and set the fk to
"one.rename2" - removes the ValueError .
Another error:
{{{ValueError: Related model 'one.Rename1' cannot be resolved}}}
is thrown on migrating which is removed if we add a field instead of
"pass" inside {{{one.rename1}}} model.
--
Ticket URL: <https://code.djangoproject.com/ticket/28056#comment:10>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070188211c1f69-cdd0d560-b0a6-42c1-bd07-4af06ba82737-000000%40eu-central-1.amazonses.com.