Re: [Django] #35149: JSONField db_default requires wrapping values in json.dumps()

2024-02-04 Thread Django
#35149: JSONField db_default requires wrapping values in json.dumps()
-+-
 Reporter:  David Sanders|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  JSONField| Triage Stage:  Ready for
  db_default |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Mariusz Felisiak ):

 In [changeset:"914eee1a9bee7ae48e6b23ef905ec00bcc241791" 914eee1]:
 {{{#!CommitTicketReference repository=""
 revision="914eee1a9bee7ae48e6b23ef905ec00bcc241791"
 [5.0.x] Refs #35149 -- Made equivalent db_default alterations noops.

 This allows for an easier transition of preserving the literal nature of
 non-compilable db_default.

 Backport of fe1cb62f5c3f87fafc4a6b52fee2ccc6c80c41e2 from main
 }}}
-- 
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/0107018d7462b733-eaabd408-543e-4914-89ca-b662b1073ec6-00%40eu-central-1.amazonses.com.


Re: [Django] #35149: JSONField db_default requires wrapping values in json.dumps()

2024-02-04 Thread Django
#35149: JSONField db_default requires wrapping values in json.dumps()
-+-
 Reporter:  David Sanders|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  JSONField| Triage Stage:  Ready for
  db_default |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Mariusz Felisiak ):

 In [changeset:"761946f8e1b6d725f83fa4f3b04ca9750f486009" 761946f8]:
 {{{#!CommitTicketReference repository=""
 revision="761946f8e1b6d725f83fa4f3b04ca9750f486009"
 [5.0.x] Fixed #35149 -- Fixed crashes of db_default with unresolvable
 output field.

 Field.db_default accepts either literal Python values or compilables
 (as_sql) and wrap the former ones in Value internally.

 While 1e38f11 added support for automatic resolving of output fields for
 types such as str, int, float, and other unambigous ones it's cannot do
 so for all types such as dict or even contrib.postgres and contrib.gis
 primitives.

 When a literal, non-compilable, value is provided it likely make the
 most sense to bind its output field to the field its attached to avoid
 forcing the user to provide an explicit `Value(output_field)`.

 Thanks David Sanders for the report.

 Backport of e67d7d70fa10c06aca36b9057f82054eda45269d from main
 }}}
-- 
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/0107018d7462b769-a8a935f6-b256-474b-ba9b-b602e57a55b1-00%40eu-central-1.amazonses.com.


Re: [Django] #35149: JSONField db_default requires wrapping values in json.dumps()

2024-02-04 Thread Django
#35149: JSONField db_default requires wrapping values in json.dumps()
-+-
 Reporter:  David Sanders|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:  JSONField| Triage Stage:  Ready for
  db_default |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak ):

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

Comment:

 In [changeset:"e67d7d70fa10c06aca36b9057f82054eda45269d" e67d7d70]:
 {{{#!CommitTicketReference repository=""
 revision="e67d7d70fa10c06aca36b9057f82054eda45269d"
 Fixed #35149 -- Fixed crashes of db_default with unresolvable output
 field.

 Field.db_default accepts either literal Python values or compilables
 (as_sql) and wrap the former ones in Value internally.

 While 1e38f11 added support for automatic resolving of output fields for
 types such as str, int, float, and other unambigous ones it's cannot do
 so for all types such as dict or even contrib.postgres and contrib.gis
 primitives.

 When a literal, non-compilable, value is provided it likely make the
 most sense to bind its output field to the field its attached to avoid
 forcing the user to provide an explicit `Value(output_field)`.

 Thanks David Sanders for the report.
 }}}
-- 
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/0107018d74607c4e-0e94a8f0-e7cc-4c47-944d-052a5fc02ee8-00%40eu-central-1.amazonses.com.


Re: [Django] #35149: JSONField db_default requires wrapping values in json.dumps()

2024-02-04 Thread Django
#35149: JSONField db_default requires wrapping values in json.dumps()
-+-
 Reporter:  David Sanders|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  JSONField| Triage Stage:  Ready for
  db_default |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Mariusz Felisiak ):

 In [changeset:"fe1cb62f5c3f87fafc4a6b52fee2ccc6c80c41e2" fe1cb62]:
 {{{#!CommitTicketReference repository=""
 revision="fe1cb62f5c3f87fafc4a6b52fee2ccc6c80c41e2"
 Refs #35149 -- Made equivalent db_default alterations noops.

 This allows for an easier transition of preserving the literal nature of
 non-compilable db_default.
 }}}
-- 
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/0107018d74607bff-13af3fb4-ed64-4404-bf61-ddba704ae88e-00%40eu-central-1.amazonses.com.


Re: [Django] #35149: JSONField db_default requires wrapping values in json.dumps()

2024-02-04 Thread Django
#35149: JSONField db_default requires wrapping values in json.dumps()
-+-
 Reporter:  David Sanders|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  JSONField| Triage Stage:  Ready for
  db_default |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * stage:  Accepted => Ready for checkin

-- 
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/0107018d7349b9c8-6374f0c5-9104-4271-8459-e9f378ef7c92-00%40eu-central-1.amazonses.com.


Re: [Django] #35149: JSONField db_default requires wrapping values in json.dumps()

2024-02-02 Thread Django
#35149: JSONField db_default requires wrapping values in json.dumps()
-+-
 Reporter:  David Sanders|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  JSONField| Triage Stage:  Accepted
  db_default |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * has_patch:  0 => 1

-- 
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/0107018d6dac6050-90b79a43-d9ee-48e4-9f70-775c0d03b9c5-00%40eu-central-1.amazonses.com.


Re: [Django] #35149: JSONField db_default requires wrapping values in json.dumps()

2024-02-02 Thread Django
#35149: JSONField db_default requires wrapping values in json.dumps()
-+-
 Reporter:  David Sanders|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  JSONField| Triage Stage:  Accepted
  db_default |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Simon Charette):

 I should be able to work on it this weekend, this have been a bit hectic
 at work this week. If someone wants to pick it up to work begins sooner
 feel free to do so, I'm happy to review the changes.
-- 
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/0107018d6b9a2018-52eaeef1-8d2f-4bd4-8fa7-dbfdc8c32bc0-00%40eu-central-1.amazonses.com.


Re: [Django] #35149: JSONField db_default requires wrapping values in json.dumps()

2024-02-02 Thread Django
#35149: JSONField db_default requires wrapping values in json.dumps()
-+-
 Reporter:  David Sanders|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  JSONField| Triage Stage:  Accepted
  db_default |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Natalia Bidart):

 Thank you Simon for grabbing this ticket. Is there anything that we/I can
 do to help?
-- 
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/0107018d6b2b748c-24a37b7b-75fc-46ca-9e32-98b91faf2e22-00%40eu-central-1.amazonses.com.


Re: [Django] #35149: JSONField db_default requires wrapping values in json.dumps()

2024-01-31 Thread Django
#35149: JSONField db_default requires wrapping values in json.dumps()
-+-
 Reporter:  David Sanders|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  JSONField| Triage Stage:  Accepted
  db_default |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Carlton Gibson):

 * cc: Carlton Gibson (added)

-- 
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/0107018d63a19785-d717f843-447c-47dd-962d-78d72281d6ac-00%40eu-central-1.amazonses.com.


Re: [Django] #35149: JSONField db_default requires wrapping values in json.dumps()

2024-01-30 Thread Django
#35149: JSONField db_default requires wrapping values in json.dumps()
-+-
 Reporter:  David Sanders|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  JSONField| Triage Stage:  Accepted
  db_default |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Lily Foote):

 * cc: Lily Foote (added)

-- 
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/0107018d5b21e88c-d02f10aa-ebaa-44d3-8808-630997bb5f31-00%40eu-central-1.amazonses.com.


Re: [Django] #35149: JSONField db_default requires wrapping values in json.dumps()

2024-01-30 Thread Django
#35149: JSONField db_default requires wrapping values in json.dumps()
-+-
 Reporter:  David Sanders|Owner:  Simon
 |  Charette
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  JSONField| Triage Stage:  Accepted
  db_default |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * owner:  nobody => Simon Charette
 * status:  new => assigned

-- 
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/0107018d5afdbd2d-5c11ab4f-e78d-43b4-890e-b7901400517e-00%40eu-central-1.amazonses.com.


Re: [Django] #35149: JSONField db_default requires wrapping values in json.dumps()

2024-01-29 Thread Django
#35149: JSONField db_default requires wrapping values in json.dumps()
-+-
 Reporter:  David Sanders|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  JSONField| Triage Stage:  Accepted
  db_default |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by David Sanders):

 > I feel like implicit output_field assignment only makes sense in a
 context where we offer no way for the user to set it such as when they
 provide a non-expression themselves. In all other cases the user can
 provide an explicit output_field so it feels like we'd be guessing for
 them.

 Yep agreed, so thinking more about this:

 >when they provide a non-expression themselves.

 This is handled when you wrap it with Value so all good ✓

 > in all other cases

 What made me wonder was this case `foo =
 JSONField(db_default=Value({'foo': 'bar'}))` however if we setup the
 warning one option may be to include warning about expressions that don't
 resolve like this.

 For complex expressions that don't resolve ideally an output_field should
 be supplied. Implicit setting output_field isn't helpful here 

 > That's a good one. I'd say we might want to consider a check in future
 versions but not necessarily backport such check to 5.0 and have this work
 included as part of this ticket?

 Yup not as a backport   As per process will ask on forum before creating
 a ticket.

 > Were you interested in taking the work when you reported the issue
 David?

 Not especially 路‍♂️  I feel like you've already authored a solution ☺️
-- 
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/0107018d58977c4b-4839b88a-2ae5-4c78-9204-fc1abd32b7a9-00%40eu-central-1.amazonses.com.


Re: [Django] #35149: JSONField db_default requires wrapping values in json.dumps()

2024-01-29 Thread Django
#35149: JSONField db_default requires wrapping values in json.dumps()
-+-
 Reporter:  David Sanders|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  JSONField| Triage Stage:  Accepted
  db_default |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by Simon Charette):

 > If someone provided supplied an expression without an output_field, and
 it's not resolvable, should your cached property try to set it?

 I feel like implicit `output_field` assignment only makes sense in a
 context where we offer no way for the user to set it such as when they
 provide a non-expression themselves. In all other cases the user can
 provide an explicit `output_field` so it feels like we'd be guessing for
 them.

 > Also should there be a check to warn if someone supplied an expression
 with a resolved type not matching the field?

 That's a good one. I'd say we might want to consider a check in future
 versions but not necessarily backport such check to 5.0 and have this work
 included as part of this ticket?

 > Simon, David, thanks for the details so far! Would any of you be
 available to provide a fix for this?

 I'm happy to provide a fix myself or let someone familiar with the
 `db_default` work do it as well and provide a review. Were you interested
 in taking the work when you reported the issue David?
-- 
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/0107018d583e367e-6aafcdfe-ef9b-44a7-9894-a5a0ce1aae3d-00%40eu-central-1.amazonses.com.


Re: [Django] #35149: JSONField db_default requires wrapping values in json.dumps()

2024-01-29 Thread Django
#35149: JSONField db_default requires wrapping values in json.dumps()
-+-
 Reporter:  David Sanders|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  JSONField| Triage Stage:  Accepted
  db_default |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Natalia Bidart):

 * cc: Simon Charette (added)

Comment:

 Simon, David, thanks for the details so far! Would any of you be available
 to provide a fix for this?
-- 
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/0107018d568b871e-92dacb01-52f2-4c1b-832e-26c28dbd0bf3-00%40eu-central-1.amazonses.com.


Re: [Django] #35149: JSONField db_default requires wrapping values in json.dumps()

2024-01-28 Thread Django
#35149: JSONField db_default requires wrapping values in json.dumps()
-+-
 Reporter:  David Sanders|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  5.0
  (models, ORM)  |
 Severity:  Release blocker  |   Resolution:
 Keywords:  JSONField| Triage Stage:  Accepted
  db_default |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Comment (by David Sanders):

 1. Nice, yes editing the migration to define `output_field=JSONField()`
 works 
 2. Yes reproducible on psycopg2
-- 
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/0107018d50dd241d-726c7fd2-e173-4d12-b270-11185a90495a-00%40eu-central-1.amazonses.com.