I want to rename a model.
From "BaseSpaceLibraryName" to "LibraryKit"
class LibraryKit (models.Model):
libraryName = models.CharField(max_length=125)
generatedat = models.DateTimeField(auto_now_add=True)
class Projects(models.Model):
LibraryKit_id = models.ForeignKey(
LibraryKit,
on_delete=models.CASCADE , null=True)
When running the makemigrations I confirm that model is renamed,
and I get the following code on the migrations file
# Generated by Django 2.2 on 2019-10-24 20:20
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('wetlab', '0105_auto_20191017_2257'),
]
operations = [
migrations.RenameModel(
old_name='BaseSpaceLibraryName',
new_name='LibraryKit',
),
]
However when running the migrate command , no SQL commands are created, and I get this error:
ValueError: The field wetlab.Projects.LibraryKit_id was declared with a lazy reference to 'wetlab.basespacelibraryname', but app 'wetlab' doesn't provide model 'basespacelibraryname'.
Even if a "fake" this change, next time I execute "migrate" (without any change in the models) I get the same error.
The only way I solved it, was to make a fake-initial an doing manually changes on MySQL.
Searching at similar issue at internet, what I get in the migration file is ok.
So I asking if it is a bug in the code ? Or there is something I am doing wrong?
I am using the django version 2.2.6
Thanks