patchew-project / patchew

A patch email tracking and testing system
MIT License
72 stars 24 forks source link

Cannot edit project in admin site #117

Closed famz closed 5 years ago

famz commented 5 years ago

There is always this error

image

bonzini commented 5 years ago

Saw it too, will look at it.

bonzini commented 5 years ago

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.

bonzini commented 5 years ago

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).

bonzini commented 5 years ago

Posted at https://patchew.org/Patchew/20190502111804.15843-1-pbonzini@redhat.com/

bonzini commented 5 years ago

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.

bonzini commented 5 years ago

Update started.

bonzini commented 5 years ago

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).