13. Create Django Survey Sessions¶
Although the forms for the Django surveys are already in the Django database, dated instances of the surveys, called sessions, are not yet created.
Start neurowiki_2016 and log in:
ssh -p 8015 firstname.lastname@example.org
Check for and install system updates on the virtual machine:
sudo apt-get update sudo apt-get dist-upgrade sudo apt-get autoremove
Start neurowiki_2015 if it is not already running.
Export the Django survey sessions from the previous year (you will be prompted three times for last year’s NeuroWiki password):
ssh email@example.com "/var/www/django/manage.py dumpdata survey.surveysession > ~/surveysessions_2015.json" scp firstname.lastname@example.org:surveysessions_2015.json ~/ ssh email@example.com "rm ~/surveysessions_2015.json"
Import the survey sessions (note that this will delete any survey sessions that you have created manually, which would appear on this admin page). The first command (
sed) will do a search-and-replace on the year to make updating the dates in step 7 a little faster.
sed -i 's/2015/2016/g' ~/surveysessions_2015.json /var/www/django/manage.py loaddata ~/surveysessions_2015.json rm ~/surveysessions_2015.json
Close all the imported survey sessions so that students cannot begin accessing them:
echo "UPDATE survey_surveysession SET open=0;" | mysql -u root -p djangodb
Enter the <MySQL password> when prompted.
If you haven’t done so already, update the dates on the syllabus:
Update the dates assigned to each survey session in the Django database. For each survey listed on the syllabus, click its link to navigate to the survey. From there, click the “Edit Survey” button. Change the survey date to match the new date listed on the syllabus, and then save the survey session. Do this for every survey on the syllabus.
Navigate to the Django admin page for managing all survey sessions:
Look over the list of sessions for any that still need to be updated. Fix these now.
Shut down the virtual machine:
sudo shutdown -h now
Using VirtualBox, take a snapshot of the current state of the virtual machine. Name it “Django survey sessions created”.