barseghyanartur / django-fobi

Form generator/builder application for Django done right: customisable, modular, user- and developer- friendly.
https://pypi.python.org/pypi/django-fobi
484 stars 112 forks source link

Alternative to fobi_initial_data to provide initial values? #181

Open will-emmerson opened 6 years ago

will-emmerson commented 6 years ago

I need to be able to edit form submissions (I am using customized DBStoreHandlerPlugin), i.e. when viewing a form entry it needs to pick up previously entered data. I could theoretically do this by passing initial values to view_form_entry using fobi_initial_data but this isn't going to work for longer forms with text fields because of url length limit. Any advice on how I can do this without writing my own view? I'm guessing this might be a bit easier when class-based views are finished?

barseghyanartur commented 6 years ago

@will-emmerson:

If you're not in hurry, wait until the CBVs are finished.

jstacoder commented 6 years ago

That functionality works awesomely, the way we are doing it, (so users don’t see any crazy url for the initial data) Is when they click the button to edit the form data the url is constructed in JavaScript from a python dict passed into the view, then the JavaScript opens that url in an iframe (fancybox) to display the form data to edit, then no one sees weird urls.

barseghyanartur commented 6 years ago

I'm thinking that when we have CBV ready, we could add alternative CBV views for viewing/submitting form in the db_store package, so that we could use those (over the default ones) if such functionality is needed).

jstacoder commented 5 years ago

@barseghyanartur actually we did need to override how that was happeing, and using the cbvs we just had to redefine get_initial_data and it just worked, we have the data in our own model, which we pass an id to the view, so our get_initial_data is just: return DataModel.objects.get(id=self.kwargs.get('id')).data