#28702: Field.db_type, Field.get_internal_type() and postgresql ::citext
----------------------------------+------------------------------------
     Reporter:  Дилян Палаузов    |                    Owner:  (none)
         Type:  Uncategorized     |                   Status:  new
    Component:  contrib.postgres  |                  Version:  1.11
     Severity:  Normal            |               Resolution:
     Keywords:                    |             Triage Stage:  Accepted
    Has patch:  1                 |      Needs documentation:  0
  Needs tests:  1                 |  Patch needs improvement:  0
Easy pickings:  0                 |                    UI/UX:  0
----------------------------------+------------------------------------

Comment (by Дилян Палаузов):

 If by adjusting `docs/howto/custom-model-fields.txt` and
 `test_lookup_cast` is meant something different than this, please modify
 the files according to your opinion.
 {{{
 diff --git a/docs/howto/custom-model-fields.txt b/docs/howto/custom-model-
 fields.txt
 --- a/docs/howto/custom-model-fields.txt
 +++ b/docs/howto/custom-model-fields.txt
 @@ -405,7 +405,7 @@ For example::
  The :meth:`~Field.db_type` and :meth:`~Field.rel_db_type` methods are
 called by
  Django when the framework constructs the ``CREATE TABLE`` statements for
 your
  application -- that is, when you first create your tables. The methods
 are also
 -called when constructing a ``WHERE`` clause that includes the model field
 --
 +called, together with :meth:`.get_internal_type`, when constructing a
 ``WHERE`` clause that includes the model field --
  that is, when you retrieve data using QuerySet methods like ``get()``,
  ``filter()``, and ``exclude()`` and have the model field as an argument.
 They
  are not called at any other time, so it can afford to execute slightly
 complex
 diff --git a/tests/backends/postgresql/tests.py
 b/tests/backends/postgresql/tests.py
 --- a/tests/backends/postgresql/tests.py
 +++ b/tests/backends/postgresql/tests.py
 @@ -138,6 +138,8 @@ class Tests(TestCase):
          for lookup in lookups:
              with self.subTest(lookup=lookup):
                  self.assertIn('::text', do.lookup_cast(lookup))
 +                self.assertIn('::citext', do.lookup_cast(lookup,
 'CICharField'))
 +                self.assertIn('::citext', do.lookup_cast(lookup,
 'CITextField'))

      def test_correct_extraction_psycopg2_version(self):
          from django.db.backends.postgresql.base import psycopg2_version
 }}}

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

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/072.f749c140c04492b30877c9e5b7586712%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to