[Django] #24195: Changing limit_choices_to in a ForeignKey doesn't create a migration

10 views
Skip to first unread message

Django

unread,
Jan 21, 2015, 11:53:03 AM1/21/15
to django-...@googlegroups.com
#24195: Changing limit_choices_to in a ForeignKey doesn't create a migration
--------------------------------------+------------------------
Reporter: aaugustin | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
--------------------------------------+------------------------
I thought that changing any attribute of a field — even help_text which
obviously has no effect on the database schema — required creating a
migration.

However, when I added limit_choices_to to a ForeignKey, makemigrations
didn't detect any changes. This is inconsistent. I suspect it's a bug.

--
Ticket URL: <https://code.djangoproject.com/ticket/24195>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 21, 2015, 12:06:26 PM1/21/15
to django-...@googlegroups.com
#24195: Changing limit_choices_to in a ForeignKey doesn't create a migration
----------------------------+------------------------------------

Reporter: aaugustin | Owner: nobody
Type: Bug | Status: new
Component: Migrations | Version: 1.7
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------+------------------------------------
Changes (by loic):

* stage: Unreviewed => Accepted


Comment:

Indeed, it's missing from `ForeignObject.deconstruct()` and
`ManyToManyField.deconstruct()`.

`RelatedField` the common parent of `ForeignObject` and `ManyToManyField`
doesn't have a `deconstruct()` method, since all related fields share some
common options such as `limit_choices_to`, `related_name`, etc. maybe this
is a good opportunity to refactor.

--
Ticket URL: <https://code.djangoproject.com/ticket/24195#comment:1>

Django

unread,
Nov 5, 2016, 9:08:37 AM11/5/16
to django-...@googlegroups.com
#24195: Changing limit_choices_to in a ForeignKey doesn't create a migration
----------------------------------+---------------------------------------
Reporter: Aymeric Augustin | Owner: Adam Bogdał
Type: Bug | Status: assigned
Component: Migrations | Version: 1.7

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+---------------------------------------
Changes (by Adam Bogdał):

* owner: nobody => Adam Bogdał
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/24195#comment:2>

Django

unread,
Nov 5, 2016, 10:10:03 AM11/5/16
to django-...@googlegroups.com
#24195: Changing limit_choices_to in a ForeignKey doesn't create a migration
----------------------------------+---------------------------------------
Reporter: Aymeric Augustin | Owner: Adam Bogdał
Type: Bug | Status: assigned
Component: Migrations | Version: 1.7

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+---------------------------------------
Changes (by Adam Bogdał):

* has_patch: 0 => 1


Comment:

Patch https://github.com/django/django/pull/7493

--
Ticket URL: <https://code.djangoproject.com/ticket/24195#comment:3>

Django

unread,
Nov 5, 2016, 4:43:30 PM11/5/16
to django-...@googlegroups.com
#24195: Changing limit_choices_to in a ForeignKey doesn't create a migration
----------------------------------+---------------------------------------
Reporter: Aymeric Augustin | Owner: Adam Bogdał
Type: Bug | Status: assigned
Component: Migrations | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
----------------------------------+---------------------------------------
Changes (by Simon Charette):

* needs_better_patch: 0 => 1
* version: 1.7 => master
* needs_tests: 0 => 1


Comment:

The patch is looking but it's missing tests.

--
Ticket URL: <https://code.djangoproject.com/ticket/24195#comment:4>

Django

unread,
Nov 7, 2016, 7:37:07 AM11/7/16
to django-...@googlegroups.com
#24195: Changing limit_choices_to in a ForeignKey doesn't create a migration
----------------------------------+---------------------------------------
Reporter: Aymeric Augustin | Owner: Adam Bogdał
Type: Bug | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
----------------------------------+---------------------------------------
Changes (by Adam Bogdał):

* needs_better_patch: 1 => 0


Comment:

Tests were added.

--
Ticket URL: <https://code.djangoproject.com/ticket/24195#comment:5>

Django

unread,
Nov 8, 2016, 5:49:26 PM11/8/16
to django-...@googlegroups.com
#24195: Changing limit_choices_to in a ForeignKey doesn't create a migration
----------------------------------+---------------------------------------
Reporter: Aymeric Augustin | Owner: Adam Bogdał
Type: Bug | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+---------------------------------------
Changes (by Tim Graham):

* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/24195#comment:6>

Django

unread,
Nov 8, 2016, 7:32:11 PM11/8/16
to django-...@googlegroups.com
#24195: Changing limit_choices_to in a ForeignKey doesn't create a migration
----------------------------------+---------------------------------------
Reporter: Aymeric Augustin | Owner: Adam Bogdał
Type: Bug | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
----------------------------------+---------------------------------------
Changes (by Markus Holtermann):

* needs_better_patch: 0 => 1

* needs_tests: 0 => 1


Comment:

Patch lacks support for `Q` objects which are supported in
`limit_choices_to`

--
Ticket URL: <https://code.djangoproject.com/ticket/24195#comment:7>

Django

unread,
Mar 25, 2017, 2:27:24 PM3/25/17
to django-...@googlegroups.com
#24195: Changing limit_choices_to in a ForeignKey doesn't create a migration
----------------------------------+---------------------------------------
Reporter: Aymeric Augustin | Owner: Adam Bogdał
Type: Bug | Status: assigned
Component: Migrations | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+---------------------------------------
Changes (by Tim Graham):

* needs_better_patch: 1 => 0


* needs_tests: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/24195#comment:8>

Django

unread,
Jun 14, 2017, 9:39:42 AM6/14/17
to django-...@googlegroups.com
#24195: Changing limit_choices_to in a ForeignKey doesn't create a migration
----------------------------------+---------------------------------------
Reporter: Aymeric Augustin | Owner: Adam Bogdał
Type: Bug | Status: closed
Component: Migrations | Version: master
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+---------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"cd2fe829dddb4c8914ac62c93cd6d750a4e9c30c" cd2fe82]:
{{{
#!CommitTicketReference repository=""
revision="cd2fe829dddb4c8914ac62c93cd6d750a4e9c30c"
Fixed #24195 -- Deconstructed the limit_choices_to option of related
fields.

Migrations will now be created for changes to limit_choices_to.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/24195#comment:9>

Reply all
Reply to author
Forward
0 new messages