Re: [Django] #29391: Postgres array lookups need to call get_db_prep_value to adapt values to their db representation (FieldGetDbPrepValueMixin)

2019-08-21 Thread Django
#29391: Postgres array lookups need to call get_db_prep_value to adapt values to
their db representation (FieldGetDbPrepValueMixin)
-+-
 Reporter:  Gavin Wahl   |Owner:  vinay
 |  karanam
 Type:  Bug  |   Status:  closed
Component:  contrib.postgres |  Version:  2.0
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by felixxm):

 3.0

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.27b51d274fb5c43646a9c1570b1bef8a%40djangoproject.com.


Re: [Django] #29391: Postgres array lookups need to call get_db_prep_value to adapt values to their db representation (FieldGetDbPrepValueMixin)

2019-08-21 Thread Django
#29391: Postgres array lookups need to call get_db_prep_value to adapt values to
their db representation (FieldGetDbPrepValueMixin)
-+-
 Reporter:  Gavin Wahl   |Owner:  vinay
 |  karanam
 Type:  Bug  |   Status:  closed
Component:  contrib.postgres |  Version:  2.0
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Andrey Torsunov):

 Which version of Django will have these changes? Thanks

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.eef8634531ebf206acd490c63e387162%40djangoproject.com.


Re: [Django] #29391: Postgres array lookups need to call get_db_prep_value to adapt values to their db representation (FieldGetDbPrepValueMixin)

2019-02-09 Thread Django
#29391: Postgres array lookups need to call get_db_prep_value to adapt values to
their db representation (FieldGetDbPrepValueMixin)
-+-
 Reporter:  Gavin Wahl   |Owner:  vinay
 |  karanam
 Type:  Bug  |   Status:  closed
Component:  contrib.postgres |  Version:  2.0
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham ):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"5a36c81f58b8ff45d8dac052343722c54e3fa521" 5a36c81f]:
 {{{
 #!CommitTicketReference repository=""
 revision="5a36c81f58b8ff45d8dac052343722c54e3fa521"
 Fixed #29391 -- Made PostgresSimpleLookup respect
 Field.get_db_prep_value().
 }}}

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.8030cc95e5eeeb10a3116f91ba46c992%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29391: Postgres array lookups need to call get_db_prep_value to adapt values to their db representation (FieldGetDbPrepValueMixin)

2019-02-03 Thread Django
#29391: Postgres array lookups need to call get_db_prep_value to adapt values to
their db representation (FieldGetDbPrepValueMixin)
-+-
 Reporter:  Gavin Wahl   |Owner:  vinay
 |  karanam
 Type:  Bug  |   Status:  assigned
Component:  contrib.postgres |  Version:  2.0
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by vinay karanam):

 * owner:  (none) => vinay karanam
 * status:  new => assigned
 * has_patch:  0 => 1


Comment:

 [https://github.com/django/django/pull/10927 PR]

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.4e382280f5c58ce1bed875184afc87d3%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29391: Postgres array lookups need to call get_db_prep_value to adapt values to their db representation (FieldGetDbPrepValueMixin)

2018-05-09 Thread Django
#29391: Postgres array lookups need to call get_db_prep_value to adapt values to
their db representation (FieldGetDbPrepValueMixin)
--+
 Reporter:  Gavin Wahl|Owner:  (none)
 Type:  Bug   |   Status:  new
Component:  contrib.postgres  |  Version:  2.0
 Severity:  Normal|   Resolution:
 Keywords:| Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+
Changes (by Tim Graham):

 * type:  Uncategorized => Bug
 * stage:  Unreviewed => Accepted


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.6ade658a3c57ba7b4af217d95c0cafbb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #29391: Postgres array lookups need to call get_db_prep_value to adapt values to their db representation (FieldGetDbPrepValueMixin)

2018-05-08 Thread Django
#29391: Postgres array lookups need to call get_db_prep_value to adapt values to
their db representation (FieldGetDbPrepValueMixin)
+
   Reporter:  Gavin Wahl|  Owner:  (none)
   Type:  Uncategorized | Status:  new
  Component:  contrib.postgres  |Version:  2.0
   Severity:  Normal|   Keywords:
   Triage Stage:  Unreviewed|  Has patch:  0
Needs documentation:  0 |Needs tests:  0
Patch needs improvement:  0 |  Easy pickings:  0
  UI/UX:  0 |
+
 I have have a model that has an ArrayField of objects that need to be
 adapted to database values (EnumField from https://github.com/hzdg/django-
 enumfields).

 The custom array lookups in django.contrib.postgres.arrays are not
 correctly calling the base fields get_db_prep_value/get_prep_value before
 passing the objects to the db api.

 Repro:

 {{{#!python
 import enum

 from django.db import models
 from django.contrib.postgres.fields import ArrayField


 class TestEnum(enum.Enum):
 VALUE_1 = 'value_1'


 class EnumField(models.CharField):
 def get_prep_value(self, value):
 if value is None:
 return None
 else:
 return value.value


 class TestModel(models.Model):
 array_of_enums = ArrayField(EnumField(max_length=20))


 TestModel.objects.filter(array_of_enums__contains=[TestEnum.VALUE_1])
 }}}

 Currently this fails with:

 {{{
 Traceback (most recent call last):
   File "django/db/backends/utils.py", line 64, in execute
 return self.cursor.execute(sql, params)
 psycopg2.ProgrammingError: can't adapt type 'TestEnum'

 The above exception was the direct cause of the following exception:

 Traceback (most recent call last):
   File "", line 1, in 
   File "django/db/models/query.py", line 226, in __repr__
 data = list(self[:REPR_OUTPUT_SIZE + 1])
   File "django/db/models/query.py", line 250, in __iter__
 self._fetch_all()
   File "django/db/models/query.py", line 1118, in _fetch_all
 self._result_cache = list(self._iterable_class(self))
   File "django/db/models/query.py", line 53, in __iter__
 results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
   File "django/db/models/sql/compiler.py", line 899, in execute_sql
 raise original_exception
   File "django/db/models/sql/compiler.py", line 889, in execute_sql
 cursor.execute(sql, params)
   File "django/db/backends/utils.py", line 79, in execute
 return super(CursorDebugWrapper, self).execute(sql, params)
   File "django/db/backends/utils.py", line 64, in execute
 return self.cursor.execute(sql, params)
   File "django/db/utils.py", line 94, in __exit__
 six.reraise(dj_exc_type, dj_exc_value, traceback)
   File "django/utils/six.py", line 685, in reraise
 raise value.with_traceback(tb)
   File "django/db/backends/utils.py", line 64, in execute
 return self.cursor.execute(sql, params)
 django.db.utils.ProgrammingError: can't adapt type 'TestEnum'
 }}}

 I expect it to succeed and generate a WHERE clause of `array_of_enums @>
 ARRAY['value_1']`.

 I think the fix is just to have the lookups inherit from
 `FieldGetDbPrepValueMixin`.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.fb0bf8ceece3deb6661a1e39e09c1b69%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.