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

Can't get saved form data entries working #218

Closed mema0341 closed 5 years ago

mema0341 commented 5 years ago

I've followed the documentation in https://django-fobi.readthedocs.io/en/0.13.10/ and the Quick Start to try and get the saved data entries to appear but with no success. I've add the db_store to my installed apps and this code at the bottom of forms.py:

def custom_actions(self): """Adding a link to view the saved form entries.

:return iterable:
"""
return (
    (
        reverse('fobi.contrib.plugins.form_handlers.db_store.view_saved_form_data_entries'),
        _("View entries"),
        'glyphicon glyphicon-list'
    ),
)

With no success.

Any tips?

barseghyanartur commented 5 years ago

@mema0341:

Probably you have forgotten to add db_store handler to your form.

mema0341 commented 5 years ago

Isn't that what the custom_action does?

mema0341 commented 5 years ago

from django import forms from fobi.base import BasePluginForm

class SampleTextareaForm(forms.Form, BasePluginForm): plugin_data_fields = [ ("name", ""), ("label", ""), ("initial", ""), ("required", False) ]

name = forms.CharField(label="Name", required=True)
label = forms.CharField(label="Label", required=True)
initial = forms.CharField(label="Initial", required=False)
required = forms.BooleanField(label="Required", required=False)

def custom_actions(self): return ( ( reverse('fobi.contrib.plugins.form_handlers.db_store.view_saved_form_dataentries'), ("View entries"), 'glyphicon glyphicon-list' ), )

barseghyanartur commented 5 years ago

@mema0341

See the online demo. If it works for you, double check your settings and see the example project.

barseghyanartur commented 5 years ago

@mema0341:

As far as I understand, you want to have your form submissions saved. DB store form handler plugin is responsible for that. In order to have it working, follow the documentation precisely.

https://github.com/barseghyanartur/django-fobi/tree/master/src/fobi/contrib/plugins/form_handlers/db_store

So, you need to (1) have it in the URLs, (2) add it to your INSTALLED_APPS and (3) assign it to every form you want to use it with.

If you still can't make it working, contact me by email (see AUTHOR section of the main README.rst). I could consult you more (premium paid support).

mema0341 commented 5 years ago

Thanks Artur, I guess I was just getting confused because the forms I created were from clicking the "Create Form" button, not forms that I have specifically created myself and therefore I haven't assigned db_store to those forms. Can you point me to where this is discussed in the documentation?

barseghyanartur commented 5 years ago

@mema0341:

Sorry, I can't do more than I already did.

mema0341 commented 5 years ago

That's ok! Thanks for all of your help :) also figured it out using the very helpful screenshots in the docs. Sorry for not understanding immediately, I am very new to Django.