[Django] #25274: inspectdb does not properly handle renamed fields for unique_together

21 views
Skip to first unread message

Django

unread,
Aug 13, 2015, 11:04:45 PM8/13/15
to django-...@googlegroups.com
#25274: inspectdb does not properly handle renamed fields for unique_together
-------------------------------------+-------------------------------------
Reporter: johnmoore | Owner: nobody
Type: Uncategorized | Status: new
Component: Core (Management | Version: 1.8
commands) | Keywords: inspectdb,
Severity: Normal | unique_together
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
When I last used inspectdb, a field named "from" in a table was renamed
automatically to "from_field." There was a comment in the output: "Field
renamed because it was a Python reserved word." But for the
unique_together meta property for that model, the "from" field name was
used, not the "from_field" name. Thus I received an error when using
runserver: "'unique_together' refers to the non-existent field 'from'."

The original issue for adding unique_together support is #23028, I
believe.

Here's an example of what I mean:

{{{

class PsSpecificPrice(models.Model):
. . .
from_field = models.DateTimeField(db_column='from') # Field renamed
because it was a Python reserved word.
to = models.DateTimeField()

class Meta:
managed = False
db_table = 'ps_specific_price'
unique_together = ((. . . 'from', 'to'),)
}}}

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

Django

unread,
Aug 14, 2015, 3:43:55 AM8/14/15
to django-...@googlegroups.com
#25274: inspectdb does not properly handle renamed fields for unique_together
-------------------------------------+-------------------------------------
Reporter: johnmoore | Owner: nobody
Type: Bug | Status: new

Component: Core (Management | Version: 1.8
commands) |
Severity: Normal | Resolution:
Keywords: inspectdb, | Triage Stage: Accepted
unique_together |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by claudep):

* needs_better_patch: => 0
* stage: Unreviewed => Accepted
* type: Uncategorized => Bug
* needs_tests: => 0
* needs_docs: => 0


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

Django

unread,
Aug 17, 2015, 11:01:30 PM8/17/15
to django-...@googlegroups.com
#25274: inspectdb does not properly handle renamed fields for unique_together
-------------------------------------+-------------------------------------
Reporter: johnmoore | Owner:
| andersonresende
Type: Bug | Status: assigned

Component: Core (Management | Version: 1.8
commands) |
Severity: Normal | Resolution:
Keywords: inspectdb, | Triage Stage: Accepted
unique_together |
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by andersonresende):

* status: new => assigned
* owner: nobody => andersonresende


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

Django

unread,
Nov 9, 2015, 4:00:29 PM11/9/15
to django-...@googlegroups.com
#25274: inspectdb does not properly handle renamed fields for unique_together
-------------------------------------+-------------------------------------
Reporter: johnmoore | Owner:
| andersonresende
Type: Bug | Status: assigned
Component: Core (Management | Version: 1.8
commands) |
Severity: Normal | Resolution:
Keywords: inspectdb, | Triage Stage: Accepted
unique_together |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by jbzdak):

* has_patch: 0 => 1


Comment:

Patch submitted in: https://github.com/django/django/pull/5562

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

Django

unread,
Nov 14, 2015, 2:14:13 PM11/14/15
to django-...@googlegroups.com
#25274: inspectdb does not properly handle renamed fields for unique_together
-------------------------------------+-------------------------------------
Reporter: johnmoore | Owner:
Type: Bug | Status: new

Component: Core (Management | Version: 1.8
commands) |
Severity: Normal | Resolution:
Keywords: inspectdb, | Triage Stage: Accepted
unique_together |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by andersonresende):

* status: assigned => new
* owner: andersonresende =>


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

Django

unread,
Nov 25, 2015, 1:15:19 PM11/25/15
to django-...@googlegroups.com
#25274: inspectdb does not properly handle renamed fields for unique_together
-------------------------------------+-------------------------------------
Reporter: johnmoore | Owner: Tim
| Graham <timograham@…>
Type: Bug | Status: closed

Component: Core (Management | Version: 1.8
commands) |
Severity: Normal | Resolution: fixed

Keywords: inspectdb, | Triage Stage: Accepted
unique_together |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* owner: => Tim Graham <timograham@…>
* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"2cb50f935aa70e91dd6c2f253becd636a2eb6fb7" 2cb50f93]:
{{{
#!CommitTicketReference repository=""
revision="2cb50f935aa70e91dd6c2f253becd636a2eb6fb7"
Fixed #25274 --- Made inspectdb handle renamed fields in unique_together.
}}}

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

Django

unread,
Nov 25, 2015, 1:19:34 PM11/25/15
to django-...@googlegroups.com
#25274: inspectdb does not properly handle renamed fields for unique_together
-------------------------------------+-------------------------------------
Reporter: johnmoore | Owner: Tim
| Graham <timograham@…>
Type: Bug | Status: closed
Component: Core (Management | Version: 1.8
commands) |
Severity: Normal | Resolution: fixed
Keywords: inspectdb, | Triage Stage: Accepted
unique_together |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"834ad41472e240e951230e52aa698ae7a3d52eb9" 834ad414]:
{{{
#!CommitTicketReference repository=""
revision="834ad41472e240e951230e52aa698ae7a3d52eb9"
[1.8.x] Fixed #25274 --- Made inspectdb handle renamed fields in
unique_together.

Backport of 2cb50f935aa70e91dd6c2f253becd636a2eb6fb7 from master
}}}

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

Django

unread,
Nov 25, 2015, 1:19:36 PM11/25/15
to django-...@googlegroups.com
#25274: inspectdb does not properly handle renamed fields for unique_together
-------------------------------------+-------------------------------------
Reporter: johnmoore | Owner: Tim
| Graham <timograham@…>
Type: Bug | Status: closed
Component: Core (Management | Version: 1.8
commands) |
Severity: Normal | Resolution: fixed
Keywords: inspectdb, | Triage Stage: Accepted
unique_together |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"023bf66bff8aa09e67c7d397707d46d67ecc2c55" 023bf66b]:
{{{
#!CommitTicketReference repository=""
revision="023bf66bff8aa09e67c7d397707d46d67ecc2c55"
[1.9.x] Fixed #25274 --- Made inspectdb handle renamed fields in
unique_together.

Backport of 2cb50f935aa70e91dd6c2f253becd636a2eb6fb7 from master
}}}

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

Django

unread,
Nov 25, 2015, 6:45:29 PM11/25/15
to django-...@googlegroups.com
#25274: inspectdb does not properly handle renamed fields for unique_together
-------------------------------------+-------------------------------------
Reporter: johnmoore | Owner: Tim
| Graham <timograham@…>
Type: Bug | Status: closed
Component: Core (Management | Version: 1.8
commands) |
Severity: Normal | Resolution: fixed
Keywords: inspectdb, | Triage Stage: Accepted
unique_together |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"6914a716cb062a9a3648deb0360b7e276cd59dba" 6914a716]:
{{{
#!CommitTicketReference repository=""
revision="6914a716cb062a9a3648deb0360b7e276cd59dba"
[1.8.x] Refs #25274 -- Added missing argument to contrib.gis' inspectdb.
}}}

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

Reply all
Reply to author
Forward
0 new messages