{{{
from django.db import models
class Parent(models.Model):
name = models.CharField(max_length=50)
class Child(models.Model):
parent = models.ForeignKey('polls.Parent')
class Meta:
default_related_name = 'children'
ordering = ('id', )
}}}
- Run `makemigrations` command this will create `0001_initial.py`
migration.
- Now go to `models.py` and remove `default_related_name` from `Child`
model.
- Run `makemigrations` multiple times and it will create same migration
again and again.
I have created a project to reproduce this issue:
https://github.com/intellisense/django-infinite-migrations
--
Ticket URL: <https://code.djangoproject.com/ticket/29755>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* component: Core (Management commands) => Migrations
* version: 2.1 => 1.11
* stage: Unreviewed => Accepted
Comment:
Bug report seems to be against Django 1.11 but I verified that it affects
master as of today (1b1f64ee5a78cc217fead52cbae23114502cf564).
--
Ticket URL: <https://code.djangoproject.com/ticket/29755#comment:1>
* owner: nobody => Simon Charette
* status: new => assigned
* has_patch: 0 => 1
Comment:
It was a simple matter of adding the option to
`AlterModelOptions.ALTER_OPTION_KEYS`
https://github.com/django/django/pull/10389
--
Ticket URL: <https://code.djangoproject.com/ticket/29755#comment:2>
* stage: Accepted => Ready for checkin
Comment:
Yep. Looks good.
--
Ticket URL: <https://code.djangoproject.com/ticket/29755#comment:3>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"a4495f4b989dc919d80fcf9f38e31e247faa94fb" a4495f4b]:
{{{
#!CommitTicketReference repository=""
revision="a4495f4b989dc919d80fcf9f38e31e247faa94fb"
Fixed #29755 -- Made migrations detect changes to
Meta.default_related_name.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29755#comment:4>
Comment (by Tim Graham <timograham@…>):
In [changeset:"4c5a8c6f50577daa8b8aaef28a8f32ab34185e80" 4c5a8c6]:
{{{
#!CommitTicketReference repository=""
revision="4c5a8c6f50577daa8b8aaef28a8f32ab34185e80"
[2.1.x] Fixed #29755 -- Made migrations detect changes to
Meta.default_related_name.
Backport of a4495f4b989dc919d80fcf9f38e31e247faa94fb from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/29755#comment:5>