New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
groupfeature admin validation refuses valid values #3331
Comments
@rjsparks@nostrum.com changed status from |
@mark@painless-security.com changed status from |
@mark@painless-security.com set owner to |
@mark@painless-security.com commented That analysis seems to be pretty close, but not exactly what's going on. Other people have commented on this, such as on Stack Overflow. The bug is that The Stack Overflow article has a suggestion on how to fix it, which seems straightforward enough. However, this has been fixed in the latest release of django, which poses the question of whether there is a way to fix it in such a way that we remember to un-do it when that django upgrade happens. Robert, do you have a standard method of marking some bit of code as needing updating whenever the next django upgrade happens? |
@mark@painless-security.com commented Oh, wait, I see now that we're using a third-party JSONField library instead of one included in django. Let me see what to do with that. |
@mark@painless-security.com commented It looks like the |
@mark@painless-security.com changed status from |
@mark@painless-security.com set resolution to |
@mark@painless-security.com commented Fixed in 604d6ed: Add a new Django field, IETFJSONField This field is needed because the plain JSONField does not permit empty arrays - [] - or empty objects - {} - when the field is marked as required. Those values explicitly evaluate to a null value, and are rejected. Instead, the IETFJSONField accepts two new arguments to control this:
This allows the programmer to specify either a positive or negative statement of what values to accept. Fixes issue #3331. Commit ready for merge. |
@rjsparks@nostrum.com commented This commit is missing the migration it needs. I'm taking care of that while merging, but in the future, please be sure to include it. Does the code still need a flag to indicate it needs attention when upgrading to Django 3? |
@rjsparks@nostrum.com commented Fixed in c596605: Merged in 604d6ed from mark@painless-security.com:
|
owner:mark@painless-security.com
resolution_fixed
type_defect
| by rjsparks@nostrum.comThere are several JSONField fields in GroupFeature
Most of them should be able to hold an empty list '[]' but the admin does not accept that as a valid value, probably because it is falsy and the field is required.
Issue migrated from trac:3331 at 2022-03-04 09:06:15 +0000
The text was updated successfully, but these errors were encountered: