class Foo(models.Model):
url = models.URLField("URL", blank=True)
class Bar(Foo):
blip = models.CharField(max_length=10)
class Meta:
unique_together = (
'url',
'blip'
)
---
$ python manage.py check
System check identified no issues (0 silenced).
---
$ python manage.py makemigrations
$ python manage.py migrate
File "/usr/lib/python3.3/site-
packages/Django-1.7b1-py3.3.egg/django/db/backends/utils.py", line 61, in
execute
return self.cursor.execute(sql, params)
psycopg2.ProgrammingError: column "url" named in key does not exist
--
Ticket URL: <https://code.djangoproject.com/ticket/22356>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: shai (added)
* needs_better_patch: => 0
* component: Migrations => Core (System checks)
* needs_tests: => 1
* needs_docs: => 0
* stage: Unreviewed => Accepted
Comment:
This cannot work when you are using multi-table inheritance -- the two
columns are in separate tables, and you cannot place a cross-table
constraint.
This probably belongs in "system checks".
It can work if the parent is abstract.
(accepting based on report, with no attempt to reproduce)
(I am hesitant to mark it, not being familiar enough with the checks code,
but this is probably an easy-pickings ticket)
--
Ticket URL: <https://code.djangoproject.com/ticket/22356#comment:1>
Comment (by adrien):
I'm able to reproduce.
--
Ticket URL: <https://code.djangoproject.com/ticket/22356#comment:2>
* cc: adrien (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/22356#comment:3>
* component: Core (System checks) => Migrations
Comment:
Digging in the code, I would say this belongs to Migrations.
--
Ticket URL: <https://code.djangoproject.com/ticket/22356#comment:4>
* component: Migrations => Core (System checks)
Comment:
@adrien: for this to belong in migrations, you need to point out something
that migrations could do to fix it.
Please leave this in "system checks" until you can produce an SQL snippet
that works on some database backend, and creates the expected constraint.
--
Ticket URL: <https://code.djangoproject.com/ticket/22356#comment:5>
* owner: nobody => frog32
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/22356#comment:6>
* has_patch: 0 => 1
* stage: Accepted => Unreviewed
Comment:
Pull request: https://github.com/django/django/pull/2548
--
Ticket URL: <https://code.djangoproject.com/ticket/22356#comment:7>
* stage: Unreviewed => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/22356#comment:8>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"0bcc92c6917738caa2f08ec16d26fad62974fb47"]:
{{{
#!CommitTicketReference repository=""
revision="0bcc92c6917738caa2f08ec16d26fad62974fb47"
Fixed #22356 -- Added a check to make sure unique_together fields are
local.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/22356#comment:9>