--
Ticket URL: <https://code.djangoproject.com/ticket/24928>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* type: Bug => New feature
* stage: Unreviewed => Accepted
Comment:
There's an interesting question about how contrib.postgres can
"contribute" introspection rules to the postgres backend. Maybe the
contrib.postgres fields should be handled in a separate ticket.
--
Ticket URL: <https://code.djangoproject.com/ticket/24928#comment:1>
Comment (by claudep):
IMHO, introspection should show the most accurate type, independently of
the presence of `contrib.postgres` in the INSTALLED_APPS.
--
Ticket URL: <https://code.djangoproject.com/ticket/24928#comment:2>
Comment (by timgraham):
Claude, the issue in my mind is adding contrib references to
`django/db/backends/postgresql_psycopg2/introspection.py`. If we allow
`contrib.postgres` to play by special rules, that's not very friendly to
third-party apps that might wish to add introspection for their own
fields. But you have more experience in this area than I do, so please
give your thoughts if you had ideas on how this should work.
--
Ticket URL: <https://code.djangoproject.com/ticket/24928#comment:3>
Comment (by claudep):
For me, this is not special rules, it's the rule "Django tries its best to
introspect the database fields". If anyone want to provide contrib.mysql
or contrib.oracle with custom fields, she's welcome to do so and we'll
also be able to improve introspection for those backends.
Currently Django outputs `models.TextField(blank=True, null=True) # This
field type is a guess.` for fields it doesn't know. Even if some field
type is not implemented by Django models, we could imagine that we provide
better hints (provided the type code is known), and point to popular
third-party packages which implements those fields, inside comments.
--
Ticket URL: <https://code.djangoproject.com/ticket/24928#comment:4>
Comment (by timgraham):
What I envisioned for my proposal is a way for any app to contribute a
mapping to a particular database backend's
`DatabaseIntrospection.data_types_reverse` dictionary. I guess it might
work something like `south.modelsinspector.add_introspection_rules` does,
although I haven't looked at the implementation of that. Of course there's
also the need to add the appropriate import in the models file that
inspectdb generates since all fields won't be in `django.db.models`
anymore.
--
Ticket URL: <https://code.djangoproject.com/ticket/24928#comment:5>
--
Ticket URL: <https://code.djangoproject.com/ticket/24928#comment:6>
* status: new => assigned
* owner: nobody => claudep
--
Ticket URL: <https://code.djangoproject.com/ticket/24928#comment:7>
Comment (by claudep):
As `UUIDField` is a bit different (available in all backends with
different implementation), I created a
[https://github.com/django/django/pull/6939 pull request] just for that
field.
A separate pull request will be proposed for other PostgreSQL-specific
fields.
--
Ticket URL: <https://code.djangoproject.com/ticket/24928#comment:8>
* has_patch: 0 => 1
Comment:
The "final" [https://github.com/django/django/pull/6942 pull request],
including the commit linked from the previous comment and the fix for
#25454.
--
Ticket URL: <https://code.djangoproject.com/ticket/24928#comment:9>
Comment (by Claude Paroz <claude@…>):
In [changeset:"3ea7167bb599536b48422d1fa841a2d378c98a4a" 3ea7167]:
{{{
#!CommitTicketReference repository=""
revision="3ea7167bb599536b48422d1fa841a2d378c98a4a"
Refs #24928 -- Added introspection support for UUIDField
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24928#comment:10>
Comment (by Claude Paroz <claude@…>):
In [changeset:"0cbb6ac00770d201b8f30a404d516b97fe41485d" 0cbb6ac0]:
{{{
#!CommitTicketReference repository=""
revision="0cbb6ac00770d201b8f30a404d516b97fe41485d"
Refs #24928 -- Added introspection support for PostgreSQL JSONField
Thanks Adam Johnson and Tim Graham for the reviews.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24928#comment:11>
Comment (by Claude Paroz <claude@…>):
In [changeset:"a599ae6018f748f66e774604d12989911ea09d33" a599ae60]:
{{{
#!CommitTicketReference repository=""
revision="a599ae6018f748f66e774604d12989911ea09d33"
Refs #24928 -- Added introspection support for PostgreSQL RangeField
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24928#comment:12>
* needs_better_patch: 0 => 1
Comment:
HStoreField and ArrayField support still missing.
--
Ticket URL: <https://code.djangoproject.com/ticket/24928#comment:13>
* owner: Claude Paroz => (none)
* status: assigned => new
--
Ticket URL: <https://code.djangoproject.com/ticket/24928#comment:14>