--
Ticket URL: <https://code.djangoproject.com/ticket/18081>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_docs: => 0
* needs_better_patch: => 0
* needs_tests: => 0
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/18081#comment:1>
* cc: charette.s@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/18081#comment:2>
* needs_better_patch: 0 => 1
Comment:
Two years later, I guess the branch probably doesn't merge cleanly.
--
Ticket URL: <https://code.djangoproject.com/ticket/18081#comment:3>
Comment (by timgraham):
I am not sure if this is still an issue with the `SchemaEditor` backends.
I updated Anssi's test (attached) and it passes at
28cb272a7279e6dfc4d5c53838ebf7343c3e66b5, however, the
`SchemaEditor._model_indexes_sql()` method still
has[https://github.com/django/django/blob/244404227e8a1c5e241658ef0df789a28ed3bbc6/django/db/backends/base/schema.py#L852-L853
a condition to skip proxy models].
--
Ticket URL: <https://code.djangoproject.com/ticket/18081#comment:3>
* Attachment "18081-test.diff" added.
Comment (by MarkusH):
I don't see why that line in the `SchemaEditor` should be wrong. Proxy
models don't have any database representation on their own
(https://docs.djangoproject.com/en/1.8/topics/db/models/#proxy-models) and
thus don't have any indices. Without digging into the issue too deep, this
seems more like a bug in the assignment of related objects to me.
--
Ticket URL: <https://code.djangoproject.com/ticket/18081#comment:4>
* cc: charette.s@… (removed)
* cc: charettes (added)
Comment:
This is not an issue anymore since calls to
[https://github.com/django/django/blob/244404227e8a1c5e241658ef0df789a28ed3bbc6/django/db/backends/base/schema.py#L872-L888
_create_fk_sql] are not conditional to ` not
field.target_field.model._meta.proxy`
([https://github.com/django/django/blob/244404227e8a1c5e241658ef0df789a28ed3bbc6/django/db/backends/base/schema.py#L251-L252
create_model],
[https://github.com/django/django/blob/244404227e8a1c5e241658ef0df789a28ed3bbc6/django/db/backends/base/schema.py#L411-L412
add_field],
[https://github.com/django/django/blob/244404227e8a1c5e241658ef0df789a28ed3bbc6/django/db/backends/base/schema.py#L714-L722
alter_field]).
I think a more appropriate regression test could live in `test_operations`
and issue an `AddField` of a foreign key pointing to `ProxyPony` and make
sure the constraint exists. Naturally the test should be
`skipUnlessDBFeature('supports_foreign_keys')`.
--
Ticket URL: <https://code.djangoproject.com/ticket/18081#comment:5>
Comment (by charettes):
[https://github.com/django/django/pull/5120 PR].
--
Ticket URL: <https://code.djangoproject.com/ticket/18081#comment:6>
Comment (by Tim Graham <timograham@…>):
In [changeset:"8e8c0792c07f6dfbee5115d29911191adee04f2e" 8e8c0792]:
{{{
#!CommitTicketReference repository=""
revision="8e8c0792c07f6dfbee5115d29911191adee04f2e"
Refs #18081 -- Asserted db constraints are created for fk to proxy models.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/18081#comment:7>
* status: new => closed
* resolution: => fixed
--
Ticket URL: <https://code.djangoproject.com/ticket/18081#comment:8>