﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
23503	renaming model with self-referential ManyToManyField breaks DB schema	Sergey Fedoseev	Sergey Fedoseev	"Steps to reproduce:

* initial `models.py` in `test` app:

{{{
from django.db import models

class Thing(models.Model):

    things = models.ManyToManyField('self')
}}}

* do

{{{
manage.py makemigrations test
}}}

* change model's name:

{{{
from django.db import models

class OtherThing(models.Model):

    things = models.ManyToManyField('self')
}}}

* do

{{{
manage.py makemigrations test
manage.py migrate
}}}

* in `manage.py shell`:

{{{
from test.models import OtherThing; OtherThing.things.through.objects.all()
}}}

* last line results in:

{{{
<repr(<django.db.models.query.QuerySet at 0x7fcdea125290>) failed: django.db.utils.ProgrammingError: ОШИБКА:  колонка test_otherthing_things.from_otherthing_id не существует
LINE 1: SELECT ""test_otherthing_things"".""id"", ""test_otherthing_thing...
                                              ^
>
}}}
"	Bug	closed	Migrations	1.7	Release blocker	fixed			Accepted	1	0	0	0	0	0
