update to django 2.0
parent
6672fa575b
commit
7ea4019f27
|
@ -61,7 +61,7 @@ First, create a folder for your new site:
|
||||||
|
|
||||||
Create a virtual environment so your python packages don't influence your system
|
Create a virtual environment so your python packages don't influence your system
|
||||||
|
|
||||||
virtualenv --no-site-packages -p python2.7 .
|
virtualenv --no-site-packages -p python3.6 .
|
||||||
|
|
||||||
Activate your virtual environment
|
Activate your virtual environment
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ Activate your virtual environment
|
||||||
|
|
||||||
Install Django
|
Install Django
|
||||||
|
|
||||||
pip install django==1.8.18
|
pip install django==2.2.16
|
||||||
|
|
||||||
Create your Django site
|
Create your Django site
|
||||||
|
|
||||||
|
@ -359,5 +359,7 @@ Updated for Django 1.11
|
||||||
---------------
|
---------------
|
||||||
Updated for Python 3.6
|
Updated for Python 3.6
|
||||||
|
|
||||||
|
6.0
|
||||||
|
---------------
|
||||||
|
Updated for Django 2.0 +
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Generated by Django 2.0.13 on 2020-09-17 20:29
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Book',
|
||||||
|
fields=[
|
||||||
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('title', models.CharField(default='', max_length=1000)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
|
@ -43,13 +43,12 @@ INSTALLED_APPS = (
|
||||||
'example',
|
'example',
|
||||||
)
|
)
|
||||||
|
|
||||||
MIDDLEWARE_CLASSES = (
|
MIDDLEWARE = (
|
||||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||||
'django.middleware.locale.LocaleMiddleware',
|
'django.middleware.locale.LocaleMiddleware',
|
||||||
'django.middleware.common.CommonMiddleware',
|
'django.middleware.common.CommonMiddleware',
|
||||||
'django.middleware.csrf.CsrfViewMiddleware',
|
'django.middleware.csrf.CsrfViewMiddleware',
|
||||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||||
'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
|
|
||||||
'questionnaire.request_cache.RequestCacheMiddleware',
|
'questionnaire.request_cache.RequestCacheMiddleware',
|
||||||
'django.contrib.messages.middleware.MessageMiddleware',
|
'django.contrib.messages.middleware.MessageMiddleware',
|
||||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||||
|
|
|
@ -12,5 +12,5 @@ urlpatterns = [
|
||||||
|
|
||||||
# admin
|
# admin
|
||||||
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
||||||
url(r'^admin/', include(admin.site.urls)),
|
url(r'^admin/', admin.site.urls),
|
||||||
]
|
]
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
"""
|
||||||
|
WSGI config for questionnaire example project.
|
||||||
|
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||||
|
For more information on this file, see
|
||||||
|
https://docs.djangoproject.com/en/1.7/howto/deployment/wsgi/
|
||||||
|
"""
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'example.settings')
|
||||||
|
|
||||||
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
|
application = get_wsgi_application()
|
|
@ -0,0 +1,133 @@
|
||||||
|
# Generated by Django 2.0.13 on 2020-08-28 23:36
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('questionnaire', '0004_auto_20160929_1800'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='choice',
|
||||||
|
name='text_de',
|
||||||
|
field=models.CharField(blank=True, default='', max_length=200, verbose_name='Choice Text'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='question',
|
||||||
|
name='extra_de',
|
||||||
|
field=models.CharField(blank=True, help_text='Extra information (use on question type)', max_length=512, null=True, verbose_name='Extra information'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='question',
|
||||||
|
name='footer_de',
|
||||||
|
field=models.TextField(blank=True, default='', help_text='Footer rendered below the question', verbose_name='Footer'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='question',
|
||||||
|
name='text_de',
|
||||||
|
field=models.TextField(blank=True, default='', verbose_name='Text'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='questionset',
|
||||||
|
name='text_de',
|
||||||
|
field=models.TextField(blank=True, default='', help_text='HTML or Text', verbose_name='Text'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='choice',
|
||||||
|
name='text_en',
|
||||||
|
field=models.CharField(default='', max_length=200, verbose_name='Choice Text'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='choice',
|
||||||
|
name='value',
|
||||||
|
field=models.CharField(default='', max_length=64, verbose_name='Short Value'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='question',
|
||||||
|
name='checks',
|
||||||
|
field=models.CharField(blank=True, help_text='Additional checks to be performed for this value (space separated) <br /><br />For text fields, <tt>required</tt> is a valid check.<br />For yes/no choice, <tt>required</tt>, <tt>required-yes</tt>, and <tt>required-no</tt> are valid.<br /><br />If this question is required only if another question\'s answer is something specific, use <tt>requiredif="QuestionNumber,Value"</tt> or <tt>requiredif="QuestionNumber,!Value"</tt> for anything but a specific value. You may also combine tests appearing in <tt>requiredif</tt> by joining them with the words <tt>and</tt> or <tt>or</tt>, eg. <tt>requiredif="Q1,A or Q2,B"</tt>', max_length=512, null=True, verbose_name='Additional checks'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='question',
|
||||||
|
name='footer_en',
|
||||||
|
field=models.TextField(blank=True, default='', help_text='Footer rendered below the question', verbose_name='Footer'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='question',
|
||||||
|
name='number',
|
||||||
|
field=models.CharField(help_text='eg. <tt>1</tt>, <tt>2a</tt>, <tt>2b</tt>, <tt>3c</tt><br /> Number is also used for ordering questions.', max_length=8),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='question',
|
||||||
|
name='parse_html',
|
||||||
|
field=models.BooleanField(default=False, verbose_name='Render html in Footer?'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='question',
|
||||||
|
name='sort_id',
|
||||||
|
field=models.IntegerField(blank=True, help_text='Questions within a questionset are sorted by sort order first, question number second', null=True),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='question',
|
||||||
|
name='text_en',
|
||||||
|
field=models.TextField(blank=True, default='', verbose_name='Text'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='question',
|
||||||
|
name='type',
|
||||||
|
field=models.CharField(choices=[('open', 'Open Answer, single line [input]'), ('open-textfield', 'Open Answer, multi-line [textarea]'), ('choice-yesno', 'Yes/No Choice [radio]'), ('choice-yesnocomment', 'Yes/No Choice with optional comment [radio, input]'), ('choice-yesnodontknow', "Yes/No/Don't know Choice [radio]"), ('choice-yesno-optional', 'Optional Yes/No Choice [radio]'), ('choice-yesnocomment-optional', 'Optional Yes/No Choice with optional comment [radio, input]'), ('choice-yesnodontknow-optional', "Optional Yes/No/Don't know Choice [radio]"), ('comment', 'Comment Only'), ('choice', 'Choice [radio]'), ('choice-freeform', 'Choice with a freeform option [radio]'), ('choice-optional', 'Optional choice [radio]'), ('choice-freeform-optional', 'Optional choice with a freeform option [radio]'), ('dropdown', 'Dropdown choice [select]'), ('choice-multiple', 'Multiple-Choice, Multiple-Answers [checkbox]'), ('choice-multiple-freeform', 'Multiple-Choice, Multiple-Answers, plus freeform [checkbox, input]'), ('choice-multiple-values', 'Multiple-Choice, Multiple-Answers [checkboxes], plus value box [input] for each selected answer'), ('range', 'Range of numbers [select]'), ('number', 'Number [input]'), ('timeperiod', 'Time Period [input, select]'), ('custom', 'Custom field'), ('sameas', 'Same as Another Question (put sameas=question.number in checks or sameasid=question.id)')], help_text="Determines the means of answering the question. An open question gives the user a single-line textfield, multiple-choice gives the user a number of choices he/she can choose from. If a question is multiple-choice, enter the choices this user can choose from below'.", max_length=32, verbose_name='Type of question'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='questionnaire',
|
||||||
|
name='admin_access_only',
|
||||||
|
field=models.BooleanField(default=False, verbose_name='Only allow access to logged in users? (This allows entering paper questionnaires without allowing new external submissions)'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='questionnaire',
|
||||||
|
name='parse_html',
|
||||||
|
field=models.BooleanField(default=False, verbose_name='Render html instead of name for questionnaire?'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='questionnaire',
|
||||||
|
name='redirect_url',
|
||||||
|
field=models.CharField(blank=True, default='', help_text="URL to redirect to when Questionnaire is complete. Macros: $SUBJECTID, $RUNID, $LANG. Leave blank to render the 'complete.$LANG.html' template.", max_length=128),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='questionset',
|
||||||
|
name='checks',
|
||||||
|
field=models.CharField(blank=True, help_text='Current options are \'femaleonly\' or \'maleonly\' and shownif="QuestionNumber,Answer" which takes the same format as <tt>requiredif</tt> for questions.', max_length=256),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='questionset',
|
||||||
|
name='parse_html',
|
||||||
|
field=models.BooleanField(default=False, verbose_name='Render html in heading?'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='questionset',
|
||||||
|
name='text_en',
|
||||||
|
field=models.TextField(default='', help_text='HTML or Text', verbose_name='Text'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='subject',
|
||||||
|
name='formtype',
|
||||||
|
field=models.CharField(choices=[('email', 'Subject receives emails'), ('paperform', 'Subject is sent paper form')], default='email', max_length=16, verbose_name='Form Type'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='subject',
|
||||||
|
name='gender',
|
||||||
|
field=models.CharField(blank=True, choices=[('unset', 'Unset'), ('male', 'Male'), ('female', 'Female')], default='unset', max_length=8, verbose_name='Gender'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='subject',
|
||||||
|
name='language',
|
||||||
|
field=models.CharField(choices=[('en', 'English'), ('de', 'Deutsch')], default='en', max_length=5, verbose_name='Language'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='subject',
|
||||||
|
name='state',
|
||||||
|
field=models.CharField(choices=[('active', 'Active'), ('inactive', 'Inactive')], default='inactive', max_length=16, verbose_name='State'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -0,0 +1,23 @@
|
||||||
|
# Generated by Django 2.0.13 on 2020-09-17 20:10
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('questionnaire', '0005_auto_20200828_2336'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='question',
|
||||||
|
name='footer_de',
|
||||||
|
field=models.TextField(blank=True, default='', help_text='Footer rendered below the question', null=True, verbose_name='Footer'),
|
||||||
|
),
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='question',
|
||||||
|
name='footer_en',
|
||||||
|
field=models.TextField(blank=True, default='', help_text='Footer rendered below the question', null=True, verbose_name='Footer'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -386,7 +386,7 @@ class Question(models.Model, metaclass=TransMeta):
|
||||||
"You may also combine tests appearing in <tt>requiredif</tt> "
|
"You may also combine tests appearing in <tt>requiredif</tt> "
|
||||||
"by joining them with the words <tt>and</tt> or <tt>or</tt>, "
|
"by joining them with the words <tt>and</tt> or <tt>or</tt>, "
|
||||||
'eg. <tt>requiredif="Q1,A or Q2,B"</tt>')
|
'eg. <tt>requiredif="Q1,A or Q2,B"</tt>')
|
||||||
footer = models.TextField(u"Footer", help_text="Footer rendered below the question", default="", blank=True)
|
footer = models.TextField(u"Footer", help_text="Footer rendered below the question", default="", null=True, blank=True)
|
||||||
|
|
||||||
parse_html = models.BooleanField("Render html in Footer?", null=False, default=False)
|
parse_html = models.BooleanField("Render html in Footer?", null=False, default=False)
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
# Generated by Django 2.0.13 on 2020-09-17 20:29
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='Page',
|
||||||
|
fields=[
|
||||||
|
('slug', models.SlugField(primary_key=True, serialize=False, unique=True)),
|
||||||
|
('title_en', models.CharField(max_length=256, verbose_name='Title')),
|
||||||
|
('title_de', models.CharField(blank=True, max_length=256, null=True, verbose_name='Title')),
|
||||||
|
('body_en', models.TextField(verbose_name='Body')),
|
||||||
|
('body_de', models.TextField(blank=True, null=True, verbose_name='Body')),
|
||||||
|
('public', models.BooleanField(default=True)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
]
|
|
@ -671,7 +671,7 @@ def new_questionnaire(request, item_id):
|
||||||
|
|
||||||
|
|
||||||
def questionnaires(request):
|
def questionnaires(request):
|
||||||
if not request.user.is_authenticated() :
|
if not request.user.is_authenticated :
|
||||||
return render(request, "questionnaires.html")
|
return render(request, "questionnaires.html")
|
||||||
items = item_model.objects.all()
|
items = item_model.objects.all()
|
||||||
questionnaires = Questionnaire.objects.all()
|
questionnaires = Questionnaire.objects.all()
|
||||||
|
|
4
setup.py
4
setup.py
|
@ -7,7 +7,7 @@ def read(fname):
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="fef-questionnaire",
|
name="fef-questionnaire",
|
||||||
version="5.0",
|
version="6.0",
|
||||||
description="A Django application for creating online questionnaires/surveys.",
|
description="A Django application for creating online questionnaires/surveys.",
|
||||||
long_description=read("README.md"),
|
long_description=read("README.md"),
|
||||||
long_description_content_type="text/markdown",
|
long_description_content_type="text/markdown",
|
||||||
|
@ -30,7 +30,7 @@ setup(
|
||||||
],
|
],
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'django<2',
|
'django>=2',
|
||||||
'django-transmeta-eh',
|
'django-transmeta-eh',
|
||||||
'django-compat',
|
'django-compat',
|
||||||
'pyyaml',
|
'pyyaml',
|
||||||
|
|
Loading…
Reference in New Issue