Cannot edit project in admin site
Closed this issue · 7 comments
Saw it too, will look at it.
There is an issue with strings in JSONField, or for that matter in any Django custom field, because to_python can be called with "An instance of the correct type [or] a string" (see Django docs). The simplest "solution" seems to be to store all properties in a single JSONField instead of using a separate table. It's feasible now that we don't have anymore huge properties for the logs.
We can also get rid of JSONField by not encoding the strings: since I think we don't really need full JSON anymore for properties, and we know the type every time we read the property, we can add to the Property class getters/setters for e.g. bool_value
and num_value
. On the JavaScript side, again everything is type-safe because the type is defined by the schema. Therefore, set_property can be changed to simply use str(value)
.
I have been pushing the patches slowly to avoid breakage, and it's done as of now for next.patchew.org. patchew.org has everything but the last three patches.
However, doing this on patchew.org will incur some downtime (about half an hour) because the migration takes quite a long time and especially because I encountered a migration failure similar to https://code.djangoproject.com/ticket/23065. I worked around it by doing the "drop table" manually in psql and deploying manually a version that uses --fake
in scripts/patchew-server
's invocation of ./manage.py migrate
.
Nevertheless, I should be able to deploy this in patchew.org sometime soon. In the meanwhile, I'm leaving the issue open but adding the patchew.org
label.
Update started.
Finished (haven't yet done the table drop because I don't have time right now, but the code is running with the properties field and thus the admin is fixed).