With this extension CKAN sysadmin can set up a survey for the all the users. The Questions in the survey can be added or deleted by the sysadmin and the answers can be set up to be as text, choose one or choose multiple options. The Questions are the same for all the users.
Compatibility with core CKAN versions:
CKAN version | Compatible? |
---|---|
2.6 and earlier | not tested |
2.7 | not tested |
2.8 | not tested |
2.9 | Yes |
In order to add questions for the users, a sysadmin account is required.
- Question interface
By clicking on the icon on the top navigation bar, the sysadmin user is redirected to the User Questions page. Here the user can select what type of question wants to create, fulfill the question text and decide whether the question is required or not.
- Add Questions tab
This form on the ‘Add Questions’ tab, is allowing the sysadmin user to add the questions for the users. The sysadmin can choose one of the options to define how the Question will be answered: Text, Select One option or Select Many options. Above, in Question interface part, the Text option is displayed. Below, Select One and Select Many options are displayed. Additionally, the admin can decide whether the Question is mandatory or not by filling the Required field with Yes or No.
The sysadmin user can edit the question and all of its fields and delete it.
To install ckanext-questionnaire:
-
Activate your CKAN virtual environment, for example:
. /usr/lib/ckan/default/bin/activate
-
Clone the source and install it on the virtualenv
git clone https://github.com/keitaroinc/ckanext-questionnaire.git cd ckanext-questionnaire pip install -e . pip install -r requirements.txt
-
Add
questionnaire
to theckan.plugins
setting in your CKAN config file (by default the config file is located at/etc/ckan/default/ckan.ini
). -
Create the database tables running:
ckan -c /path/to/ini/file questionnaire init-db
-
Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu:
sudo service apache2 reload
-
For uninstalling the extension, drop the tables in the database using running:
ckan -c /path/to/ini/file questionnaire delete-db
When logging in the user is redirected to the Questions page available on the User Dashboard page. You need to add the following setting in your ckan.ini file:
route_after_login = "user.me"
To install ckanext-questionnaire for development, activate your CKAN virtualenv and do:
git clone https://github.com/keitaroinc/ckanext-questionnaire.git
cd ckanext-questionnaire
python setup.py develop
pip install -r dev-requirements.txt
To run the tests, do:
pytest --ckan-ini=test.ini