instance, associated it with a
and saved it:
class Buildings(BaseModel):
number = models.CharField(max_length=25)
class TestGeneric(models.Model):
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey()
Now I rename TestGeneric
to Building
and run
TestGeneric.objects.create(content_object=Building.objects.first())
. I'm prompted Buildings
I choose yes. I then run Building
and get:makemigrations
Regardless of what I answer Django automatically will create a new row in Did you rename the app.Buildings model to Building? [y/N]
with migrate
as the name and label. Is there any way to just rename the
The following content types are stale and need to be deleted:
app | buildings
Any objects related to these content types by a foreign key will also
be deleted. Are you sure you want to delete these content types?
If you're unsure, answer 'no'.
so that all of my TestGeneric rows aren't blown away?django_content_type
building
ContentType
Setup: Django 1.7 新的django_content_type被创建,而不是重命名旧的记录。