change mysite to example
parent
f46937c1c7
commit
bd16725d34
29
README.md
29
README.md
|
@ -73,11 +73,11 @@ Install Django
|
|||
|
||||
Create your Django site
|
||||
|
||||
django-admin.py startproject mysite
|
||||
django-admin.py startproject example
|
||||
|
||||
Create a place for the questionnare
|
||||
|
||||
cd mysite
|
||||
cd example
|
||||
mkdir apps
|
||||
cd apps
|
||||
|
||||
|
@ -95,7 +95,7 @@ The next step is to install the questionnaire.
|
|||
|
||||
If you are working with ed-questionnaire from your own fork you may want to use `python setup.py develop` instead, which will save you from running `python setup.py install` every time the questionnaire changes.
|
||||
|
||||
Now let's configure your basic questionnaire OR copy the settings.py, urls.py, and models.py files from the "example" folder into `mysite/mysite`, then skip down to [initialize your database](#initialize-the-database).
|
||||
Now let's configure your basic questionnaire OR copy the settings.py, urls.py, and models.py files from the "example" folder into `example/example`, then skip down to [initialize your database](#initialize-the-database).
|
||||
|
||||
|
||||
Also add the locale and request cache middleware to MIDDLEWARE_CLASSES:
|
||||
|
@ -104,7 +104,7 @@ Also add the locale and request cache middleware to MIDDLEWARE_CLASSES:
|
|||
|
||||
Add the questionnaire template directory as well as your own to TEMPLATES:
|
||||
|
||||
'DIRS': [os.path.join(BASE_DIR, 'mysite/templates/')],
|
||||
'DIRS': [os.path.join(BASE_DIR, 'example/templates/')],
|
||||
|
||||
If you want to use multiple languages, add the i18n context processor to TEMPLATES
|
||||
'context_processors': ['django.template.context_processors.i18n',]
|
||||
|
@ -119,12 +119,12 @@ To finish the settings, add the fef-questionaire specific parameters. For our ex
|
|||
|
||||
QUESTIONNAIRE_PROGRESS = 'async'
|
||||
QUESTIONNAIRE_USE_SESSION = False
|
||||
QUESTIONNAIRE_ITEM_MODEL = 'mysite.Book'
|
||||
QUESTIONNAIRE_ITEM_MODEL = 'example.Book'
|
||||
QUESTIONNAIRE_SHOW_ITEM_RESULTS = True
|
||||
|
||||
Next up we want to edit the `urls.py` file of your project to link the questionnaire views to your site's url configuration. The example app shows you how.
|
||||
|
||||
Finally, we want to add a model to the mysite app for us to link our questionnaires to. It needs to have a back-relation named "items"
|
||||
Finally, we want to add a model to the example app for us to link our questionnaires to. It needs to have a back-relation named "items"
|
||||
|
||||
class Book(models.Model):
|
||||
title = models.CharField(max_length=1000, default="")
|
||||
|
@ -135,13 +135,13 @@ Finally, we want to add a model to the mysite app for us to link our questionnai
|
|||
|
||||
### Initialize the database
|
||||
|
||||
Having done that we can initialize our database. (For this to work you must have set up your DATABASES in `settings.py`.). First, in your CLI navigate back to the `mysite` folder:
|
||||
Having done that we can initialize our database. (For this to work you must have set up your DATABASES in `settings.py`.). First, in your CLI navigate back to the `example` folder:
|
||||
|
||||
cd ../..
|
||||
|
||||
The check that you are in the proper folder, type `ls`: if you can see `manage.py` in your list of files, you are good. Otherwise, find your way to the folder that contains that file. Then type:
|
||||
|
||||
python manage.py syncdb
|
||||
python manage.py migrate
|
||||
|
||||
You will be asked to create a superuser.
|
||||
|
||||
|
@ -151,9 +151,9 @@ Congratulations, you have setup the basics of the questionnaire! At this point t
|
|||
|
||||
### Internationalizating the database
|
||||
|
||||
First, you want to setup the languages used in your questionnaire. Open up your `mysite` folder in your favorite text editor.
|
||||
First, you want to setup the languages used in your questionnaire. Open up your `example` folder in your favorite text editor.
|
||||
|
||||
Open `mysite/mysite/settings.py` and add following lines, representing your languages of choice:
|
||||
Open `example/example/settings.py` and add following lines, representing your languages of choice:
|
||||
|
||||
LANGUAGES = (
|
||||
('en', 'English'),
|
||||
|
@ -351,4 +351,13 @@ Version 4.0 has not been tested for compatibility with previous versions.
|
|||
* documentation has been updated to reflect Django 1.8.
|
||||
* email and subject functionality has not been tested
|
||||
|
||||
4.0.1
|
||||
---------------
|
||||
Updated for Django 1.11
|
||||
|
||||
5.0
|
||||
---------------
|
||||
Updated for Python 3.6
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,60 +1,60 @@
|
|||
- fields: {title: "A Christmas Carol"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 4
|
||||
- fields: {title: "A Little Princess"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 5
|
||||
- fields: {title: "A Portrait of the Artist as a Young Man"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 6
|
||||
- fields: {title: "A Room with a View"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 7
|
||||
- fields: {title: "Agnes Grey"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 8
|
||||
- fields: {title: "Anne of Green Gables"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 9
|
||||
- fields: {title: "The Personal History, Adventures, Experience and Observation of David Copperfield the Younger of Blunderstone Rookery"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 10
|
||||
- fields: {title: "Far From the Madding Crowd"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 11
|
||||
- fields: {title: "Howards End"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 12
|
||||
- fields: {title: "Jacob\'s Room"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 13
|
||||
- fields: {title: "The Merry Adventures of Robin Hood"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 14
|
||||
- fields: {title: "Sense and Sensibility"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 15
|
||||
- fields: {title: "The Secret Garden"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 16
|
||||
- fields: {title: "The Adventures of Tom Sawyer"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 17
|
||||
- fields: {title: "The Invisible Man"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 18
|
||||
- fields: {title: "The Last of the Mohicans"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 19
|
||||
- fields: {title: "Oliver Twist, or the Parish Boy\'s Progress"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 20
|
||||
- fields: {title: "Peter Pan in Kensington Gardens"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 21
|
||||
- fields: {title: "Tales of the Jazz Age"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 22
|
||||
- fields: {title: "Tess of the D'Urbervilles: A Pure Woman Faithfully Presented"}
|
||||
model: mysite.book
|
||||
model: example.book
|
||||
pk: 23
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"""
|
||||
Django settings for mysite project.
|
||||
Django settings for example project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 1.8.18.
|
||||
|
||||
|
@ -40,7 +40,7 @@ INSTALLED_APPS = (
|
|||
'transmeta',
|
||||
'questionnaire',
|
||||
'questionnaire.page',
|
||||
# 'mysite',
|
||||
'example',
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
|
@ -56,12 +56,12 @@ MIDDLEWARE_CLASSES = (
|
|||
'django.middleware.security.SecurityMiddleware',
|
||||
)
|
||||
|
||||
ROOT_URLCONF = 'mysite.urls'
|
||||
ROOT_URLCONF = 'example.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [os.path.join(BASE_DIR, 'mysite/templates/')],
|
||||
'DIRS': [os.path.join(BASE_DIR, 'example/templates/')],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
|
@ -75,7 +75,7 @@ TEMPLATES = [
|
|||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'mysite.wsgi.application'
|
||||
WSGI_APPLICATION = 'example.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
|
@ -145,7 +145,7 @@ QUESTIONNAIRE_USE_SESSION = False
|
|||
|
||||
# for item-linked questionnaires, defines the model used for the item-linked questionaires.
|
||||
|
||||
QUESTIONNAIRE_ITEM_MODEL = 'mysite.Book'
|
||||
QUESTIONNAIRE_ITEM_MODEL = 'example.Book'
|
||||
|
||||
# for item-linked questionnaires, show the results to any logged in user. If the results are meant to be private, this should be false, and you should wrap the corresponding views with access control appropriate to your application.
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
from django.conf.urls import patterns, include, url
|
||||
from django.conf.urls import include, url
|
||||
from django.contrib import admin
|
||||
|
||||
import questionnaire
|
||||
from questionnaire.page import views
|
||||
|
||||
admin.autodiscover()
|
||||
|
||||
urlpatterns = patterns('',
|
||||
|
||||
url(r'^$', 'questionnaire.page.views.page', {'page_to_render' : 'index'}),
|
||||
urlpatterns = [
|
||||
url(r'^$', views.page, {'page_to_render' : 'index'}),
|
||||
url(r'q/', include('questionnaire.urls')),
|
||||
|
||||
# admin
|
||||
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
url(r'^admin/', include(admin.site.urls)),
|
||||
)
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue