﻿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
25274	inspectdb does not properly handle renamed fields for unique_together	John Moore	Tim Graham <timograham@…>	"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'),)
}}}

"	Bug	closed	Core (Management commands)	1.8	Normal	fixed	inspectdb, unique_together	timograham@…	Accepted	1	0	0	0	1	0
