askvortsov1/dynamic-django-forms

claerification on ability to edit response data

stcbus opened this issue · 3 comments

So, the following is mentioned in the docs:

Responses cannot be changed after submission

Now, that seems clear and yet it seems like a necessary feature, so i just wanted some clarification

For example, let's have a form a user is submitting containing name, address, phone. It is submitted. You are saying there is no ability to edit those values later? If so, what would be the cause of that limitation? Could you not just load a form (even just using regular Django form support) with the JSON values and edit them?

To be honest, I'm not sure why I worded it that way. The only challenge is that (IIRC) responses are a dict from field label to answer value. If a field is renamed, the association between that field and any responses is lost, and not all JSON values could be loaded in. If more metadata was stored in the form instance (such as a history of form label changes), then editing responses would be pretty easy, with the exception of new fields, which would need new responses anyhow. I didn't need this in my project, and am not currently using this library, but a PR would be welcomed if there's interest.

I think I perhaps understand what you mean. Would one workaround be on any field change, to make the changes to the existing records? For example, if I rename a field - do a rename SQL operation for that JSON item for all. if I add a field, add the JSON item to all. Like a SQL migration would be, basically. Then a simple editform view could work maybe? Would you have any issues with this method?

Sorry for the late reply. That seems like it would be a good feature to have.

I just put this on the README (a bit too late, tbh), but I'm not using Django in any projects, and am open to someone else taking over maintenance of this package. I don't really have the time or need to push new features at the moment.