Re: [Django] #27697: JSONField with blank=True is rendered as non-required field in a ModelForm

2021-07-27 Thread Django
#27697: JSONField with blank=True is rendered as non-required field in a 
ModelForm
---+-
 Reporter:  aruseni|Owner:  Andrew Nester
 Type:  Bug|   Status:  closed
Component:  Documentation  |  Version:  1.10
 Severity:  Normal |   Resolution:  duplicate
 Keywords:  postgres   | Triage Stage:  Accepted
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  0  |UI/UX:  0
---+-
Changes (by Jacob Walls):

 * needs_better_patch:  1 => 0
 * has_patch:  1 => 0
 * component:  Database layer (models, ORM) => Documentation


-- 
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/065.e429c7922b3b14863f88b950aa9b05de%40djangoproject.com.


Re: [Django] #27697: JSONField with blank=True is rendered as non-required field in a ModelForm

2021-07-27 Thread Django
#27697: JSONField with blank=True is rendered as non-required field in a 
ModelForm
-+-
 Reporter:  aruseni  |Owner:  Andrew
 |  Nester
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  duplicate
 Keywords:  postgres | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Jacob Walls):

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


Comment:

 Per [https://groups.google.com/g/django-developers/c/GlYM25fdRnA
 discussion] we're going to have a look at clarifying the documentation
 around the blank=True, null=False idiom, and we can do that in #4.

-- 
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/065.c381bf0c004e95846138f43f0f9d858e%40djangoproject.com.


Re: [Django] #27697: JSONField with blank=True is rendered as non-required field in a ModelForm

2021-07-19 Thread Django
#27697: JSONField with blank=True is rendered as non-required field in a 
ModelForm
-+-
 Reporter:  aruseni  |Owner:  Andrew
 |  Nester
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  postgres | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Jacob Walls):

 I suggest marking as a duplicate of #4. Any proposal to run model-
 validation on not-nullable blankable fields would fix both (but I suggest
 `wontfix`ing #4 as the status quo represents a supported design
 pattern, will comment there shortly).

 Re: Tim's suggestion:
 > if nothing is submitted, that empty string is transformed into an empty
 dict so it can be saved

 I think this is dangerous because we should preserve the distinction
 between `None` and `{}`, in case the field is nullable. There could be
 code depending on this distinction.

-- 
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/065.a4819c8dc7b8b8d20820ef7aebdf8656%40djangoproject.com.


Re: [Django] #27697: JSONField with blank=True is rendered as non-required field in a ModelForm

2021-01-15 Thread Django
#27697: JSONField with blank=True is rendered as non-required field in a 
ModelForm
-+-
 Reporter:  aruseni  |Owner:  Andrew
 |  Nester
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  1.10
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  postgres | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * component:  contrib.postgres => Database layer (models, ORM)


-- 
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/065.a08d494b2c6b38af20dc3fb6933d63f2%40djangoproject.com.


Re: [Django] #27697: JSONField with blank=True is rendered as non-required field in a ModelForm

2017-02-16 Thread Django
#27697: JSONField with blank=True is rendered as non-required field in a 
ModelForm
-+-
 Reporter:  aruseni  |Owner:  Andrew
 |  Nester
 Type:  Bug  |   Status:  assigned
Component:  contrib.postgres |  Version:  1.10
 Severity:  Normal   |   Resolution:
 Keywords:  postgres | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham):

 * needs_better_patch:  0 => 1


Comment:

 I think what I would expect (and I'm certain open to other opinions,
 including your own if you disagree) with `blank=True` is that nothing is
 rendered in the widget and if nothing is submitted, that empty string is
 transformed into an empty dict so it can be saved. In particular, I'm
 thinking of an API context where the `initial={}` that your proposed isn't
 going to have an effect since the API is only submitted values and doesn't
 receive an initial form.

 I wish we could solve the null case without adding a new form option
 ("invalidate_null" as you proposed). If "null" is submitted though, an
 error message might indeed be more appropriate than transforming that into
 an empty dict. If we need to add some new form option, perhaps
 `allow_null=True` (default) would be more consistent with other existing
 options such as `allow_unicode`.

--
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/065.c94bee148a1a1d2f03030987cc3d970d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27697: JSONField with blank=True is rendered as non-required field in a ModelForm

2017-02-10 Thread Django
#27697: JSONField with blank=True is rendered as non-required field in a 
ModelForm
-+-
 Reporter:  aruseni  |Owner:  Andrew
 |  Nester
 Type:  Bug  |   Status:  assigned
Component:  contrib.postgres |  Version:  1.10
 Severity:  Normal   |   Resolution:
 Keywords:  postgres | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Andrew Nester):

 * needs_better_patch:  1 => 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 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/065.9b484df7a0a5804c951b007943ee5e10%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27697: JSONField with blank=True is rendered as non-required field in a ModelForm

2017-02-10 Thread Django
#27697: JSONField with blank=True is rendered as non-required field in a 
ModelForm
-+-
 Reporter:  aruseni  |Owner:  Andrew
 |  Nester
 Type:  Bug  |   Status:  assigned
Component:  contrib.postgres |  Version:  1.10
 Severity:  Normal   |   Resolution:
 Keywords:  postgres | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Andrew Nester):

 Thanks Tim!
 I've just updated my PR to make it work more clear.

 Now it's working like this.
 If we have {{{blank=True}}} set , form field will be render as NOT
 required and valid empty JSON string such as {}, [] will be successfully
 validated and saved.
 But if you try to submit just empty form field, you will get form
 validation error with message {{{ 'None' value must be valid JSON.}}}

 
[[Image(https://code.djangoproject.com/attachment/ticket/27697/Screen%20Shot%202017-02-10%20at%202.19.21%20PM.png)]]

--
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/065.8b46eff9eae8ebb20a6b5cf51bf6d2cb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27697: JSONField with blank=True is rendered as non-required field in a ModelForm

2017-02-10 Thread Django
#27697: JSONField with blank=True is rendered as non-required field in a 
ModelForm
-+-
 Reporter:  aruseni  |Owner:  Andrew
 |  Nester
 Type:  Bug  |   Status:  assigned
Component:  contrib.postgres |  Version:  1.10
 Severity:  Normal   |   Resolution:
 Keywords:  postgres | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Andrew Nester):

 * Attachment "Screen Shot 2017-02-10 at 2.19.21 PM.png" added.

 Form field error

--
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/065.126d4c34ab1f9a123e70e0b67c77582b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27697: JSONField with blank=True is rendered as non-required field in a ModelForm

2017-02-09 Thread Django
#27697: JSONField with blank=True is rendered as non-required field in a 
ModelForm
-+-
 Reporter:  aruseni  |Owner:  Andrew
 |  Nester
 Type:  Bug  |   Status:  assigned
Component:  contrib.postgres |  Version:  1.10
 Severity:  Normal   |   Resolution:
 Keywords:  postgres | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham):

 * needs_better_patch:  0 => 1


Comment:

 The behavior with a field like `data = JSONField(blank=True)` still seems
 confusing. It renders "null" in an initial form but then creates a "This
 field is required." error if you try to save that. Before this PR, a value
 of `{}` could be saved with such a field, but now it gives "This field is
 required." for that input. Is this what you expected?  If so, perhaps some
 documentation clarification is in order as this doesn't seem intuitive.

--
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/065.35ab002e8843fdc4c44d40209b5b3279%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27697: JSONField with blank=True is rendered as non-required field in a ModelForm

2017-02-06 Thread Django
#27697: JSONField with blank=True is rendered as non-required field in a 
ModelForm
-+-
 Reporter:  aruseni  |Owner:  Andrew
 |  Nester
 Type:  Bug  |   Status:  assigned
Component:  contrib.postgres |  Version:  1.10
 Severity:  Normal   |   Resolution:
 Keywords:  postgres | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Andrew Nester):

 Thanks Sayid! Just fixed it in my 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/065.310819a1432b892b7416c2eaa9e73449%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27697: JSONField with blank=True is rendered as non-required field in a ModelForm

2017-02-06 Thread Django
#27697: JSONField with blank=True is rendered as non-required field in a 
ModelForm
-+-
 Reporter:  aruseni  |Owner:  Andrew
 |  Nester
 Type:  Bug  |   Status:  assigned
Component:  contrib.postgres |  Version:  1.10
 Severity:  Normal   |   Resolution:
 Keywords:  postgres | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Sayid Munawar):

 CMIIW, in the
 [https://docs.djangoproject.com/en/dev/ref/contrib/postgres/fields/#jsonfield
 Django Docs] it is not advised to use `{}` as an empty value. it should be
 callable like `dict`

--
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/065.c5ce5c3bea58ae7ce7f843b0b38a33a6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27697: JSONField with blank=True is rendered as non-required field in a ModelForm

2017-01-30 Thread Django
#27697: JSONField with blank=True is rendered as non-required field in a 
ModelForm
-+-
 Reporter:  aruseni  |Owner:  Andrew
 |  Nester
 Type:  Bug  |   Status:  assigned
Component:  contrib.postgres |  Version:  1.10
 Severity:  Normal   |   Resolution:
 Keywords:  postgres | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Andrew Nester):

 * 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 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/065.680a40bb31aad16cd3ab602059fe05c5%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27697: JSONField with blank=True is rendered as non-required field in a ModelForm

2017-01-30 Thread Django
#27697: JSONField with blank=True is rendered as non-required field in a 
ModelForm
-+-
 Reporter:  aruseni  |Owner:  Andrew
 |  Nester
 Type:  Bug  |   Status:  assigned
Component:  contrib.postgres |  Version:  1.10
 Severity:  Normal   |   Resolution:
 Keywords:  postgres | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Andrew Nester):

 * owner:  (none) => Andrew Nester
 * status:  new => assigned


Comment:

 I've added pull request [https://github.com/django/django/pull/7990 #PR]

 I've decided to make logic so: if we have {{{blank=True}}} and
 {{{null=False}}} for {{{JSONField}}}, we make this field required with
 empty value set to } }}}

--
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/065.6ee795c96a47c2dd9d0b145f2d37cefd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27697: JSONField with blank=True is rendered as non-required field in a ModelForm

2017-01-20 Thread Django
#27697: JSONField with blank=True is rendered as non-required field in a 
ModelForm
--+
 Reporter:  aruseni   |Owner:  (none)
 Type:  Bug   |   Status:  new
Component:  contrib.postgres  |  Version:  1.10
 Severity:  Normal|   Resolution:
 Keywords:  postgres  | 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):

 * stage:  Unreviewed => Accepted


Comment:

 Accepting as the current behavior doesn't seem ideal.

--
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/065.cfdc7583db20a18d81f3411778c86a91%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27697: JSONField with blank=True is rendered as non-required field in a ModelForm

2017-01-09 Thread Django
#27697: JSONField with blank=True is rendered as non-required field in a 
ModelForm
--+--
 Reporter:  aruseni   |Owner:  (none)
 Type:  Bug   |   Status:  new
Component:  contrib.postgres  |  Version:  1.10
 Severity:  Normal|   Resolution:
 Keywords:  postgres  | Triage Stage:  Unreviewed
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  0
Easy pickings:  0 |UI/UX:  0
--+--

Comment (by Tim Graham):

 What do you think the expected behavior is in this case?

--
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/065.35d49017cb9e600aabb84bc7c0893b3c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.