askvortsov1 / dynamic-django-forms

A simple, reusable Django app that allows you to build (and respond to) dynamic forms. Perfect for surveys, position applications, etc.
MIT License
44 stars 12 forks source link

claerification on ability to edit response data #31

Open stcbus opened 1 year ago

stcbus commented 1 year ago

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?

askvortsov1 commented 1 year ago

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.

stcbus commented 1 year ago

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?

askvortsov1 commented 1 year ago

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.