{{{
class Tag(Model):
content = Charfield(...)
class CustomerModel(Model):
keywords = ManyToManyField('Tag')
}}}
this will generate 3 tables
{{{
applabel_customermodel
applabel_tag
applabel_customermodel_keywords
}}}
when I try to rename CustomerModel to Customer in a migration, the
autogenerated table is not renamed
migration:
{{{
operations = [
migrations.RenameModel('CustomerModel', 'Customer'),
]
}}}
tables:
{{{
applabel_customer
applabel_tag
applabel_customermodel_keywords
}}}
This causes my code to fail, since lookups on customer.keywords.all()
expect to find the table applabel_customer_keywords, which does not exist.
The error is observed in 1.7.1 and 1.7.2
--
Ticket URL: <https://code.djangoproject.com/ticket/24135>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* needs_tests: => 0
* needs_docs: => 0
Comment:
Managed to reproduce against master. Should this block the release of 1.8
alpha?
--
Ticket URL: <https://code.djangoproject.com/ticket/24135#comment:1>
* type: Uncategorized => Bug
Comment:
I presume it's an existing bug on 1.7 as well, in which case no.
--
Ticket URL: <https://code.djangoproject.com/ticket/24135#comment:2>
* status: new => assigned
* owner: nobody => timgraham
--
Ticket URL: <https://code.djangoproject.com/ticket/24135#comment:3>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/3923 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/24135#comment:4>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/24135#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"28db4af80a319485c0da724d692e2f8396aa57e3"]:
{{{
#!CommitTicketReference repository=""
revision="28db4af80a319485c0da724d692e2f8396aa57e3"
Fixed #24135 -- Made RenameModel rename many-to-many tables.
Thanks Simon and Markus for reviews.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24135#comment:6>
Comment (by Tim Graham <timograham@…>):
In [changeset:"065b2a82f6d7539032e15308351fa5eee95c0cb9"]:
{{{
#!CommitTicketReference repository=""
revision="065b2a82f6d7539032e15308351fa5eee95c0cb9"
[1.7.x] Fixed #24135 -- Made RenameModel rename many-to-many tables.
Thanks Simon and Markus for reviews.
Backport of 28db4af80a319485c0da724d692e2f8396aa57e3 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24135#comment:7>