From 1d1cdcdec4723bd7a067fafbdf40c49fb684dd74 Mon Sep 17 00:00:00 2001 From: Hippo Date: Thu, 23 Apr 2015 14:32:24 +0530 Subject: [PATCH] Rearranged directories and made urls and templates more generic, to make the app portable. Also removed settings.py, and non-app-specific urls in urls.py --- manage.py | 10 -- survey/admin.py | 2 +- survey/forms.py | 2 +- survey/models.py | 11 +- survey/settings.py | 163 ------------------ .../static}/css/bootstrap-responsive.css | 0 .../static}/css/bootstrap-responsive.min.css | 0 {media => survey/static}/css/bootstrap.css | 0 .../static}/css/bootstrap.min.css | 0 {media => survey/static}/css/custom.css | 0 .../images/ui-bg_flat_0_aaaaaa_40x100.png | Bin .../images/ui-bg_flat_0_eeeeee_40x100.png | Bin .../images/ui-bg_flat_55_ffffff_40x100.png | Bin .../images/ui-bg_flat_75_ffffff_40x100.png | Bin .../images/ui-bg_glass_65_ffffff_1x400.png | Bin .../ui-bg_highlight-soft_100_f6f6f6_1x100.png | Bin .../ui-bg_highlight-soft_25_0073ea_1x100.png | Bin .../ui-bg_highlight-soft_50_dddddd_1x100.png | Bin .../flick/images/ui-icons_0073ea_256x240.png | Bin .../flick/images/ui-icons_454545_256x240.png | Bin .../flick/images/ui-icons_666666_256x240.png | Bin .../flick/images/ui-icons_ff0084_256x240.png | Bin .../flick/images/ui-icons_ffffff_256x240.png | Bin .../css/flick/jquery-ui-1.9.1.custom.css | 0 .../css/flick/jquery-ui-1.9.1.custom.min.css | 0 {media => survey/static}/css/loading.gif | Bin {media => survey/static}/css/themes/dark.css | 0 .../css/themes/font/AbrilFatface-Average.css | 0 .../static}/css/themes/font/Arvo-PTSans.css | 0 .../css/themes/font/Bevan-PotanoSans.css | 0 .../css/themes/font/BreeSerif-OpenSans.css | 0 .../css/themes/font/DroidSerif-DroidSans.css | 0 .../css/themes/font/Georgia-Helvetica.css | 0 .../css/themes/font/Lekton-Molengo.css | 0 .../static}/css/themes/font/Lora-Istok.css | 0 .../themes/font/Merriweather-NewsCycle.css | 0 .../themes/font/NewsCycle-Merriweather.css | 0 .../css/themes/font/NixieOne-Ledger.css | 0 .../static}/css/themes/font/PT.css | 0 .../css/themes/font/PTSerif-PTSans.css | 0 .../css/themes/font/Pacifico-Arimo.css | 0 .../css/themes/font/PlayfairDisplay-Muli.css | 0 .../css/themes/font/PoiretOne-Molengo.css | 0 .../static}/css/themes/font/Rancho-Gudea.css | 0 .../css/themes/font/SansitaOne-Kameron.css | 0 .../static}/css/themes/timeline-dark.png | Bin .../static}/css/themes/timeline-texture.png | Bin {media => survey/static}/css/timeline.css | 0 {media => survey/static}/css/timeline.png | Bin {media => survey/static}/img/collapse.gif | Bin {media => survey/static}/img/collapse.png | Bin {media => survey/static}/img/expand.png | Bin {media => survey/static}/js/README.md | 0 {media => survey/static}/js/application.js | 0 {media => survey/static}/js/bootstrap.js | 0 {media => survey/static}/js/bootstrap.min.js | 0 .../js/google-code-prettify/prettify.css | 0 .../js/google-code-prettify/prettify.js | 0 {media => survey/static}/js/jquery-1.8.2.js | 0 {media => survey/static}/js/jquery-min.js | 0 .../static}/js/jquery-ui-1.9.1.custom.js | 0 .../static}/js/jquery-ui-1.9.1.custom.min.js | 0 .../static}/js/jquery.collapsible.js | 0 {media => survey/static}/js/jquery.js | 0 {media => survey/static}/js/storyjs-embed.js | 0 {media => survey/static}/js/timeline-min.js | 0 {media => survey/static}/js/timeline.js | 0 .../templates/survey}/confirm.html | 4 +- survey/templates/survey/index.html | 20 +++ survey/templates/survey/survey.html | 59 +++++++ survey/templates/survey/survey_base.html | 35 ++++ survey/urls.py | 24 +-- survey/views.py | 13 +- templates/base.html | 63 ------- templates/index.html | 22 --- templates/privacy.html | 23 --- templates/survey.html | 97 ----------- 77 files changed, 132 insertions(+), 416 deletions(-) delete mode 100755 manage.py delete mode 100644 survey/settings.py rename {media => survey/static}/css/bootstrap-responsive.css (100%) rename {media => survey/static}/css/bootstrap-responsive.min.css (100%) rename {media => survey/static}/css/bootstrap.css (100%) rename {media => survey/static}/css/bootstrap.min.css (100%) rename {media => survey/static}/css/custom.css (100%) rename {media => survey/static}/css/flick/images/ui-bg_flat_0_aaaaaa_40x100.png (100%) rename {media => survey/static}/css/flick/images/ui-bg_flat_0_eeeeee_40x100.png (100%) rename {media => survey/static}/css/flick/images/ui-bg_flat_55_ffffff_40x100.png (100%) rename {media => survey/static}/css/flick/images/ui-bg_flat_75_ffffff_40x100.png (100%) rename {media => survey/static}/css/flick/images/ui-bg_glass_65_ffffff_1x400.png (100%) rename {media => survey/static}/css/flick/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png (100%) rename {media => survey/static}/css/flick/images/ui-bg_highlight-soft_25_0073ea_1x100.png (100%) rename {media => survey/static}/css/flick/images/ui-bg_highlight-soft_50_dddddd_1x100.png (100%) rename {media => survey/static}/css/flick/images/ui-icons_0073ea_256x240.png (100%) rename {media => survey/static}/css/flick/images/ui-icons_454545_256x240.png (100%) rename {media => survey/static}/css/flick/images/ui-icons_666666_256x240.png (100%) rename {media => survey/static}/css/flick/images/ui-icons_ff0084_256x240.png (100%) rename {media => survey/static}/css/flick/images/ui-icons_ffffff_256x240.png (100%) rename {media => survey/static}/css/flick/jquery-ui-1.9.1.custom.css (100%) rename {media => survey/static}/css/flick/jquery-ui-1.9.1.custom.min.css (100%) rename {media => survey/static}/css/loading.gif (100%) rename {media => survey/static}/css/themes/dark.css (100%) rename {media => survey/static}/css/themes/font/AbrilFatface-Average.css (100%) rename {media => survey/static}/css/themes/font/Arvo-PTSans.css (100%) rename {media => survey/static}/css/themes/font/Bevan-PotanoSans.css (100%) rename {media => survey/static}/css/themes/font/BreeSerif-OpenSans.css (100%) rename {media => survey/static}/css/themes/font/DroidSerif-DroidSans.css (100%) rename {media => survey/static}/css/themes/font/Georgia-Helvetica.css (100%) rename {media => survey/static}/css/themes/font/Lekton-Molengo.css (100%) rename {media => survey/static}/css/themes/font/Lora-Istok.css (100%) rename {media => survey/static}/css/themes/font/Merriweather-NewsCycle.css (100%) rename {media => survey/static}/css/themes/font/NewsCycle-Merriweather.css (100%) rename {media => survey/static}/css/themes/font/NixieOne-Ledger.css (100%) rename {media => survey/static}/css/themes/font/PT.css (100%) rename {media => survey/static}/css/themes/font/PTSerif-PTSans.css (100%) rename {media => survey/static}/css/themes/font/Pacifico-Arimo.css (100%) rename {media => survey/static}/css/themes/font/PlayfairDisplay-Muli.css (100%) rename {media => survey/static}/css/themes/font/PoiretOne-Molengo.css (100%) rename {media => survey/static}/css/themes/font/Rancho-Gudea.css (100%) rename {media => survey/static}/css/themes/font/SansitaOne-Kameron.css (100%) rename {media => survey/static}/css/themes/timeline-dark.png (100%) rename {media => survey/static}/css/themes/timeline-texture.png (100%) rename {media => survey/static}/css/timeline.css (100%) rename {media => survey/static}/css/timeline.png (100%) rename {media => survey/static}/img/collapse.gif (100%) rename {media => survey/static}/img/collapse.png (100%) rename {media => survey/static}/img/expand.png (100%) rename {media => survey/static}/js/README.md (100%) rename {media => survey/static}/js/application.js (100%) rename {media => survey/static}/js/bootstrap.js (100%) rename {media => survey/static}/js/bootstrap.min.js (100%) rename {media => survey/static}/js/google-code-prettify/prettify.css (100%) rename {media => survey/static}/js/google-code-prettify/prettify.js (100%) rename {media => survey/static}/js/jquery-1.8.2.js (100%) rename {media => survey/static}/js/jquery-min.js (100%) rename {media => survey/static}/js/jquery-ui-1.9.1.custom.js (100%) rename {media => survey/static}/js/jquery-ui-1.9.1.custom.min.js (100%) rename {media => survey/static}/js/jquery.collapsible.js (100%) rename {media => survey/static}/js/jquery.js (100%) rename {media => survey/static}/js/storyjs-embed.js (100%) rename {media => survey/static}/js/timeline-min.js (100%) rename {media => survey/static}/js/timeline.js (100%) rename {templates => survey/templates/survey}/confirm.html (73%) create mode 100644 survey/templates/survey/index.html create mode 100644 survey/templates/survey/survey.html create mode 100644 survey/templates/survey/survey_base.html delete mode 100644 templates/base.html delete mode 100644 templates/index.html delete mode 100644 templates/privacy.html delete mode 100644 templates/survey.html diff --git a/manage.py b/manage.py deleted file mode 100755 index 3cd91d73..00000000 --- a/manage.py +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env python -import os -import sys - -if __name__ == "__main__": - os.environ.setdefault("DJANGO_SETTINGS_MODULE", "survey.settings") - - from django.core.management import execute_from_command_line - - execute_from_command_line(sys.argv) diff --git a/survey/admin.py b/survey/admin.py index 79bb8e7f..f2570702 100644 --- a/survey/admin.py +++ b/survey/admin.py @@ -36,7 +36,7 @@ class AnswerIntegerInline(AnswerBaseInline): model= AnswerInteger class ResponseAdmin(admin.ModelAdmin): - list_display = ('interview_uuid', 'interviewer', 'created') + list_display = ('interview_uuid', 'created') inlines = [AnswerTextInline, AnswerRadioInline, AnswerSelectInline, AnswerSelectMultipleInline, AnswerIntegerInline] # specifies the order as well as which fields to act on readonly_fields = ('survey', 'created', 'updated', 'interview_uuid') diff --git a/survey/forms.py b/survey/forms.py index c00deba9..dba41add 100644 --- a/survey/forms.py +++ b/survey/forms.py @@ -14,7 +14,7 @@ def render(self): class ResponseForm(models.ModelForm): class Meta: model = Response - fields = ('interviewer', 'interviewee', 'conditions', 'comments') + fields = () def __init__(self, *args, **kwargs): # expects a survey object to be passed in initially diff --git a/survey/models.py b/survey/models.py index 0a07f995..683e2bf5 100644 --- a/survey/models.py +++ b/survey/models.py @@ -1,5 +1,6 @@ from django.db import models from django.core.exceptions import ValidationError +from django.core.urlresolvers import reverse class Survey(models.Model): name = models.CharField(max_length=400) @@ -13,6 +14,8 @@ def questions(self): return Question.objects.filter(survey=self.pk) else: return None + def get_absolute_url(self): + return reverse ('survey_detail', kwargs={'id': self.pk}) class Category(models.Model): name = models.CharField(max_length=400) @@ -77,10 +80,10 @@ class Response(models.Model): created = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) survey = models.ForeignKey(Survey) - interviewer = models.CharField('Name of Interviewer', max_length=400) - interviewee = models.CharField('Name of Interviewee', max_length=400) - conditions = models.TextField('Conditions during interview', blank=True, null=True) - comments = models.TextField('Any additional Comments', blank=True, null=True) + # interviewer = models.CharField('Name of Interviewer', max_length=400) + # interviewee = models.CharField('Name of Interviewee', max_length=400) + # conditions = models.TextField('Conditions during interview', blank=True, null=True) + # comments = models.TextField('Any additional Comments', blank=True, null=True) interview_uuid = models.CharField("Interview unique identifier", max_length=36) def __unicode__(self): diff --git a/survey/settings.py b/survey/settings.py deleted file mode 100644 index a854ff1c..00000000 --- a/survey/settings.py +++ /dev/null @@ -1,163 +0,0 @@ -# Django settings for survey project. - -import os - -DEBUG = True -TEMPLATE_DEBUG = DEBUG - -# Make filepaths relative to settings. -ROOT = os.path.dirname(os.path.abspath(__file__)) -path = lambda *a: os.path.join(ROOT, *a) - -ADMINS = ( - # ('Your Name', 'your_email@example.com'), -) - -MANAGERS = ADMINS - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. - 'NAME': 'survey.db', # Or path to database file if using sqlite3. - 'USER': '', # Not used with sqlite3. - 'PASSWORD': '', # Not used with sqlite3. - 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. - 'PORT': '', # Set to empty string for default. Not used with sqlite3. - } -} - -# Local time zone for this installation. Choices can be found here: -# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name -# although not all choices may be available on all operating systems. -# On Unix systems, a value of None will cause Django to use the same -# timezone as the operating system. -# If running in a Windows environment this must be set to the same as your -# system time zone. -TIME_ZONE = 'America/Los_Angeles' - -# Language code for this installation. All choices can be found here: -# http://www.i18nguy.com/unicode/language-identifiers.html -LANGUAGE_CODE = 'en-us' - -SITE_ID = 1 - -# If you set this to False, Django will make some optimizations so as not -# to load the internationalization machinery. -USE_I18N = True - -# If you set this to False, Django will not format dates, numbers and -# calendars according to the current locale. -USE_L10N = True - -# If you set this to False, Django will not use timezone-aware datetimes. -USE_TZ = True - -# Absolute filesystem path to the directory that will hold user-uploaded files. -# Example: "/home/media/media.lawrence.com/media/" -MEDIA_ROOT = path("../media/") - -# URL that handles the media served from MEDIA_ROOT. Make sure to use a -# trailing slash. -# Examples: "http://media.lawrence.com/media/", "http://example.com/media/" -MEDIA_URL = '/media' - -# Absolute path to the directory static files should be collected to. -# Don't put anything in this directory yourself; store your static files -# in apps' "static/" subdirectories and in STATICFILES_DIRS. -# Example: "/home/media/media.lawrence.com/static/" -STATIC_ROOT = '' - -# URL prefix for static files. -# Example: "http://media.lawrence.com/static/" -STATIC_URL = '/static/' - -# Additional locations of static files -STATICFILES_DIRS = ( - # Put strings here, like "/home/html/static" or "C:/www/django/static". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. -) - -# List of finder classes that know how to find static files in -# various locations. -STATICFILES_FINDERS = ( - 'django.contrib.staticfiles.finders.FileSystemFinder', - 'django.contrib.staticfiles.finders.AppDirectoriesFinder', -# 'django.contrib.staticfiles.finders.DefaultStorageFinder', -) - -# Make this unique, and don't share it with anybody. -SECRET_KEY = 'rzk0!e3eav79hs51!m4g3w!&52&o5e8yj)g70!f8$v^_vz)p7-' - -# List of callables that know how to import templates from various sources. -TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', -# 'django.template.loaders.eggs.Loader', -) - -MIDDLEWARE_CLASSES = ( - 'django.middleware.common.CommonMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - # Uncomment the next line for simple clickjacking protection: - # 'django.middleware.clickjacking.XFrameOptionsMiddleware', -) - -ROOT_URLCONF = 'survey.urls' - -# Python dotted path to the WSGI application used by Django's runserver. -WSGI_APPLICATION = 'survey.wsgi.application' - -TEMPLATE_DIRS = ( - # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". - # Always use forward slashes, even on Windows. - # Don't forget to use absolute paths, not relative paths. - path("../templates/") -) - -INSTALLED_APPS = ( - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.sites', - 'django.contrib.messages', - 'django.contrib.staticfiles', - 'django.contrib.admin', - 'django.contrib.admindocs', - 'survey', -) - -support_email = "survey@coliving.org" - - -# A sample logging configuration. The only tangible logging -# performed by this configuration is to send an email to -# the site admins on every HTTP 500 error when DEBUG=False. -# See http://docs.djangoproject.com/en/dev/topics/logging for -# more details on how to customize your logging configuration. -LOGGING = { - 'version': 1, - 'disable_existing_loggers': False, - 'filters': { - 'require_debug_false': { - '()': 'django.utils.log.RequireDebugFalse' - } - }, - 'handlers': { - 'mail_admins': { - 'level': 'ERROR', - 'filters': ['require_debug_false'], - 'class': 'django.utils.log.AdminEmailHandler' - } - }, - 'loggers': { - 'django.request': { - 'handlers': ['mail_admins'], - 'level': 'ERROR', - 'propagate': True, - }, - } -} diff --git a/media/css/bootstrap-responsive.css b/survey/static/css/bootstrap-responsive.css similarity index 100% rename from media/css/bootstrap-responsive.css rename to survey/static/css/bootstrap-responsive.css diff --git a/media/css/bootstrap-responsive.min.css b/survey/static/css/bootstrap-responsive.min.css similarity index 100% rename from media/css/bootstrap-responsive.min.css rename to survey/static/css/bootstrap-responsive.min.css diff --git a/media/css/bootstrap.css b/survey/static/css/bootstrap.css similarity index 100% rename from media/css/bootstrap.css rename to survey/static/css/bootstrap.css diff --git a/media/css/bootstrap.min.css b/survey/static/css/bootstrap.min.css similarity index 100% rename from media/css/bootstrap.min.css rename to survey/static/css/bootstrap.min.css diff --git a/media/css/custom.css b/survey/static/css/custom.css similarity index 100% rename from media/css/custom.css rename to survey/static/css/custom.css diff --git a/media/css/flick/images/ui-bg_flat_0_aaaaaa_40x100.png b/survey/static/css/flick/images/ui-bg_flat_0_aaaaaa_40x100.png similarity index 100% rename from media/css/flick/images/ui-bg_flat_0_aaaaaa_40x100.png rename to survey/static/css/flick/images/ui-bg_flat_0_aaaaaa_40x100.png diff --git a/media/css/flick/images/ui-bg_flat_0_eeeeee_40x100.png b/survey/static/css/flick/images/ui-bg_flat_0_eeeeee_40x100.png similarity index 100% rename from media/css/flick/images/ui-bg_flat_0_eeeeee_40x100.png rename to survey/static/css/flick/images/ui-bg_flat_0_eeeeee_40x100.png diff --git a/media/css/flick/images/ui-bg_flat_55_ffffff_40x100.png b/survey/static/css/flick/images/ui-bg_flat_55_ffffff_40x100.png similarity index 100% rename from media/css/flick/images/ui-bg_flat_55_ffffff_40x100.png rename to survey/static/css/flick/images/ui-bg_flat_55_ffffff_40x100.png diff --git a/media/css/flick/images/ui-bg_flat_75_ffffff_40x100.png b/survey/static/css/flick/images/ui-bg_flat_75_ffffff_40x100.png similarity index 100% rename from media/css/flick/images/ui-bg_flat_75_ffffff_40x100.png rename to survey/static/css/flick/images/ui-bg_flat_75_ffffff_40x100.png diff --git a/media/css/flick/images/ui-bg_glass_65_ffffff_1x400.png b/survey/static/css/flick/images/ui-bg_glass_65_ffffff_1x400.png similarity index 100% rename from media/css/flick/images/ui-bg_glass_65_ffffff_1x400.png rename to survey/static/css/flick/images/ui-bg_glass_65_ffffff_1x400.png diff --git a/media/css/flick/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png b/survey/static/css/flick/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png similarity index 100% rename from media/css/flick/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png rename to survey/static/css/flick/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png diff --git a/media/css/flick/images/ui-bg_highlight-soft_25_0073ea_1x100.png b/survey/static/css/flick/images/ui-bg_highlight-soft_25_0073ea_1x100.png similarity index 100% rename from media/css/flick/images/ui-bg_highlight-soft_25_0073ea_1x100.png rename to survey/static/css/flick/images/ui-bg_highlight-soft_25_0073ea_1x100.png diff --git a/media/css/flick/images/ui-bg_highlight-soft_50_dddddd_1x100.png b/survey/static/css/flick/images/ui-bg_highlight-soft_50_dddddd_1x100.png similarity index 100% rename from media/css/flick/images/ui-bg_highlight-soft_50_dddddd_1x100.png rename to survey/static/css/flick/images/ui-bg_highlight-soft_50_dddddd_1x100.png diff --git a/media/css/flick/images/ui-icons_0073ea_256x240.png b/survey/static/css/flick/images/ui-icons_0073ea_256x240.png similarity index 100% rename from media/css/flick/images/ui-icons_0073ea_256x240.png rename to survey/static/css/flick/images/ui-icons_0073ea_256x240.png diff --git a/media/css/flick/images/ui-icons_454545_256x240.png b/survey/static/css/flick/images/ui-icons_454545_256x240.png similarity index 100% rename from media/css/flick/images/ui-icons_454545_256x240.png rename to survey/static/css/flick/images/ui-icons_454545_256x240.png diff --git a/media/css/flick/images/ui-icons_666666_256x240.png b/survey/static/css/flick/images/ui-icons_666666_256x240.png similarity index 100% rename from media/css/flick/images/ui-icons_666666_256x240.png rename to survey/static/css/flick/images/ui-icons_666666_256x240.png diff --git a/media/css/flick/images/ui-icons_ff0084_256x240.png b/survey/static/css/flick/images/ui-icons_ff0084_256x240.png similarity index 100% rename from media/css/flick/images/ui-icons_ff0084_256x240.png rename to survey/static/css/flick/images/ui-icons_ff0084_256x240.png diff --git a/media/css/flick/images/ui-icons_ffffff_256x240.png b/survey/static/css/flick/images/ui-icons_ffffff_256x240.png similarity index 100% rename from media/css/flick/images/ui-icons_ffffff_256x240.png rename to survey/static/css/flick/images/ui-icons_ffffff_256x240.png diff --git a/media/css/flick/jquery-ui-1.9.1.custom.css b/survey/static/css/flick/jquery-ui-1.9.1.custom.css similarity index 100% rename from media/css/flick/jquery-ui-1.9.1.custom.css rename to survey/static/css/flick/jquery-ui-1.9.1.custom.css diff --git a/media/css/flick/jquery-ui-1.9.1.custom.min.css b/survey/static/css/flick/jquery-ui-1.9.1.custom.min.css similarity index 100% rename from media/css/flick/jquery-ui-1.9.1.custom.min.css rename to survey/static/css/flick/jquery-ui-1.9.1.custom.min.css diff --git a/media/css/loading.gif b/survey/static/css/loading.gif similarity index 100% rename from media/css/loading.gif rename to survey/static/css/loading.gif diff --git a/media/css/themes/dark.css b/survey/static/css/themes/dark.css similarity index 100% rename from media/css/themes/dark.css rename to survey/static/css/themes/dark.css diff --git a/media/css/themes/font/AbrilFatface-Average.css b/survey/static/css/themes/font/AbrilFatface-Average.css similarity index 100% rename from media/css/themes/font/AbrilFatface-Average.css rename to survey/static/css/themes/font/AbrilFatface-Average.css diff --git a/media/css/themes/font/Arvo-PTSans.css b/survey/static/css/themes/font/Arvo-PTSans.css similarity index 100% rename from media/css/themes/font/Arvo-PTSans.css rename to survey/static/css/themes/font/Arvo-PTSans.css diff --git a/media/css/themes/font/Bevan-PotanoSans.css b/survey/static/css/themes/font/Bevan-PotanoSans.css similarity index 100% rename from media/css/themes/font/Bevan-PotanoSans.css rename to survey/static/css/themes/font/Bevan-PotanoSans.css diff --git a/media/css/themes/font/BreeSerif-OpenSans.css b/survey/static/css/themes/font/BreeSerif-OpenSans.css similarity index 100% rename from media/css/themes/font/BreeSerif-OpenSans.css rename to survey/static/css/themes/font/BreeSerif-OpenSans.css diff --git a/media/css/themes/font/DroidSerif-DroidSans.css b/survey/static/css/themes/font/DroidSerif-DroidSans.css similarity index 100% rename from media/css/themes/font/DroidSerif-DroidSans.css rename to survey/static/css/themes/font/DroidSerif-DroidSans.css diff --git a/media/css/themes/font/Georgia-Helvetica.css b/survey/static/css/themes/font/Georgia-Helvetica.css similarity index 100% rename from media/css/themes/font/Georgia-Helvetica.css rename to survey/static/css/themes/font/Georgia-Helvetica.css diff --git a/media/css/themes/font/Lekton-Molengo.css b/survey/static/css/themes/font/Lekton-Molengo.css similarity index 100% rename from media/css/themes/font/Lekton-Molengo.css rename to survey/static/css/themes/font/Lekton-Molengo.css diff --git a/media/css/themes/font/Lora-Istok.css b/survey/static/css/themes/font/Lora-Istok.css similarity index 100% rename from media/css/themes/font/Lora-Istok.css rename to survey/static/css/themes/font/Lora-Istok.css diff --git a/media/css/themes/font/Merriweather-NewsCycle.css b/survey/static/css/themes/font/Merriweather-NewsCycle.css similarity index 100% rename from media/css/themes/font/Merriweather-NewsCycle.css rename to survey/static/css/themes/font/Merriweather-NewsCycle.css diff --git a/media/css/themes/font/NewsCycle-Merriweather.css b/survey/static/css/themes/font/NewsCycle-Merriweather.css similarity index 100% rename from media/css/themes/font/NewsCycle-Merriweather.css rename to survey/static/css/themes/font/NewsCycle-Merriweather.css diff --git a/media/css/themes/font/NixieOne-Ledger.css b/survey/static/css/themes/font/NixieOne-Ledger.css similarity index 100% rename from media/css/themes/font/NixieOne-Ledger.css rename to survey/static/css/themes/font/NixieOne-Ledger.css diff --git a/media/css/themes/font/PT.css b/survey/static/css/themes/font/PT.css similarity index 100% rename from media/css/themes/font/PT.css rename to survey/static/css/themes/font/PT.css diff --git a/media/css/themes/font/PTSerif-PTSans.css b/survey/static/css/themes/font/PTSerif-PTSans.css similarity index 100% rename from media/css/themes/font/PTSerif-PTSans.css rename to survey/static/css/themes/font/PTSerif-PTSans.css diff --git a/media/css/themes/font/Pacifico-Arimo.css b/survey/static/css/themes/font/Pacifico-Arimo.css similarity index 100% rename from media/css/themes/font/Pacifico-Arimo.css rename to survey/static/css/themes/font/Pacifico-Arimo.css diff --git a/media/css/themes/font/PlayfairDisplay-Muli.css b/survey/static/css/themes/font/PlayfairDisplay-Muli.css similarity index 100% rename from media/css/themes/font/PlayfairDisplay-Muli.css rename to survey/static/css/themes/font/PlayfairDisplay-Muli.css diff --git a/media/css/themes/font/PoiretOne-Molengo.css b/survey/static/css/themes/font/PoiretOne-Molengo.css similarity index 100% rename from media/css/themes/font/PoiretOne-Molengo.css rename to survey/static/css/themes/font/PoiretOne-Molengo.css diff --git a/media/css/themes/font/Rancho-Gudea.css b/survey/static/css/themes/font/Rancho-Gudea.css similarity index 100% rename from media/css/themes/font/Rancho-Gudea.css rename to survey/static/css/themes/font/Rancho-Gudea.css diff --git a/media/css/themes/font/SansitaOne-Kameron.css b/survey/static/css/themes/font/SansitaOne-Kameron.css similarity index 100% rename from media/css/themes/font/SansitaOne-Kameron.css rename to survey/static/css/themes/font/SansitaOne-Kameron.css diff --git a/media/css/themes/timeline-dark.png b/survey/static/css/themes/timeline-dark.png similarity index 100% rename from media/css/themes/timeline-dark.png rename to survey/static/css/themes/timeline-dark.png diff --git a/media/css/themes/timeline-texture.png b/survey/static/css/themes/timeline-texture.png similarity index 100% rename from media/css/themes/timeline-texture.png rename to survey/static/css/themes/timeline-texture.png diff --git a/media/css/timeline.css b/survey/static/css/timeline.css similarity index 100% rename from media/css/timeline.css rename to survey/static/css/timeline.css diff --git a/media/css/timeline.png b/survey/static/css/timeline.png similarity index 100% rename from media/css/timeline.png rename to survey/static/css/timeline.png diff --git a/media/img/collapse.gif b/survey/static/img/collapse.gif similarity index 100% rename from media/img/collapse.gif rename to survey/static/img/collapse.gif diff --git a/media/img/collapse.png b/survey/static/img/collapse.png similarity index 100% rename from media/img/collapse.png rename to survey/static/img/collapse.png diff --git a/media/img/expand.png b/survey/static/img/expand.png similarity index 100% rename from media/img/expand.png rename to survey/static/img/expand.png diff --git a/media/js/README.md b/survey/static/js/README.md similarity index 100% rename from media/js/README.md rename to survey/static/js/README.md diff --git a/media/js/application.js b/survey/static/js/application.js similarity index 100% rename from media/js/application.js rename to survey/static/js/application.js diff --git a/media/js/bootstrap.js b/survey/static/js/bootstrap.js similarity index 100% rename from media/js/bootstrap.js rename to survey/static/js/bootstrap.js diff --git a/media/js/bootstrap.min.js b/survey/static/js/bootstrap.min.js similarity index 100% rename from media/js/bootstrap.min.js rename to survey/static/js/bootstrap.min.js diff --git a/media/js/google-code-prettify/prettify.css b/survey/static/js/google-code-prettify/prettify.css similarity index 100% rename from media/js/google-code-prettify/prettify.css rename to survey/static/js/google-code-prettify/prettify.css diff --git a/media/js/google-code-prettify/prettify.js b/survey/static/js/google-code-prettify/prettify.js similarity index 100% rename from media/js/google-code-prettify/prettify.js rename to survey/static/js/google-code-prettify/prettify.js diff --git a/media/js/jquery-1.8.2.js b/survey/static/js/jquery-1.8.2.js similarity index 100% rename from media/js/jquery-1.8.2.js rename to survey/static/js/jquery-1.8.2.js diff --git a/media/js/jquery-min.js b/survey/static/js/jquery-min.js similarity index 100% rename from media/js/jquery-min.js rename to survey/static/js/jquery-min.js diff --git a/media/js/jquery-ui-1.9.1.custom.js b/survey/static/js/jquery-ui-1.9.1.custom.js similarity index 100% rename from media/js/jquery-ui-1.9.1.custom.js rename to survey/static/js/jquery-ui-1.9.1.custom.js diff --git a/media/js/jquery-ui-1.9.1.custom.min.js b/survey/static/js/jquery-ui-1.9.1.custom.min.js similarity index 100% rename from media/js/jquery-ui-1.9.1.custom.min.js rename to survey/static/js/jquery-ui-1.9.1.custom.min.js diff --git a/media/js/jquery.collapsible.js b/survey/static/js/jquery.collapsible.js similarity index 100% rename from media/js/jquery.collapsible.js rename to survey/static/js/jquery.collapsible.js diff --git a/media/js/jquery.js b/survey/static/js/jquery.js similarity index 100% rename from media/js/jquery.js rename to survey/static/js/jquery.js diff --git a/media/js/storyjs-embed.js b/survey/static/js/storyjs-embed.js similarity index 100% rename from media/js/storyjs-embed.js rename to survey/static/js/storyjs-embed.js diff --git a/media/js/timeline-min.js b/survey/static/js/timeline-min.js similarity index 100% rename from media/js/timeline-min.js rename to survey/static/js/timeline-min.js diff --git a/media/js/timeline.js b/survey/static/js/timeline.js similarity index 100% rename from media/js/timeline.js rename to survey/static/js/timeline.js diff --git a/templates/confirm.html b/survey/templates/survey/confirm.html similarity index 73% rename from templates/confirm.html rename to survey/templates/survey/confirm.html index 2528f9a0..c7793956 100644 --- a/templates/confirm.html +++ b/survey/templates/survey/confirm.html @@ -1,6 +1,6 @@ -{% extends 'base.html' %} +{% extends 'survey/survey_base.html' %} {% block body %} Thanks! Your confirmation code is {{uuid}}. Use this to refer to your response. In case you have any questions, contact {{ email }} -{% endblock %} \ No newline at end of file +{% endblock %} diff --git a/survey/templates/survey/index.html b/survey/templates/survey/index.html new file mode 100644 index 00000000..36555d2d --- /dev/null +++ b/survey/templates/survey/index.html @@ -0,0 +1,20 @@ +{% extends 'survey/survey_base.html' %} + +{% block title %}List of Surveys{% endblock %} + +{% block body %} + +
+

Survey List

+ +

Here is the list of surveys currently available on this website...

+ + + +
+ +{% endblock %} diff --git a/survey/templates/survey/survey.html b/survey/templates/survey/survey.html new file mode 100644 index 00000000..dc48bbdc --- /dev/null +++ b/survey/templates/survey/survey.html @@ -0,0 +1,59 @@ +{% extends 'survey/survey_base.html' %} + +{% load static %} +{% load survey_extras %} + +{% block body %} + +

Welcome to {{survey.name|title}}

+
+ {{survey.description|safe}} +
+ +
+
{% csrf_token %} + +
    + {% for category in categories %} +

    {{category|title}}

    +
    + {% for field in response_form %} + {% if field.field.widget.attrs.category == category %} +
  1. + {% if field.field.required %} +
    + {{ field.errors }} + * + {% else %} +
    + {{ field.errors }} + + {% endif %} + {{ field.help_text}} +
    + {{ field }} +
    +
    +
  2. + {% endif %} + {% endfor %} +
    + {% endfor %} +
+ +
+
+ +
+ +{% endblock %} + +{% block extrajs %} + + +{% endblock %} diff --git a/survey/templates/survey/survey_base.html b/survey/templates/survey/survey_base.html new file mode 100644 index 00000000..59fd1d14 --- /dev/null +++ b/survey/templates/survey/survey_base.html @@ -0,0 +1,35 @@ +{% extends 'base.html' %} +{% load static %} + {% block content %} + + + {% block wrapper %} +
+ {% endblock %} + +
+ {% block body %} + {% endblock %} + +
+
+
+ + + + + + + + + {% block extrajs %} + {% endblock %} + {% endblock %} diff --git a/survey/urls.py b/survey/urls.py index dcaef12a..a92c6091 100644 --- a/survey/urls.py +++ b/survey/urls.py @@ -1,30 +1,8 @@ -from django.conf.urls import patterns, include, url - -# Uncomment the next two lines to enable the admin: -from django.contrib import admin -import settings - -admin.autodiscover() -media_url = settings.MEDIA_URL.lstrip('/').rstrip('/') +from django.conf.urls import patterns, url urlpatterns = patterns('', # Examples: url(r'^$', 'survey.views.Index', name='home'), url(r'^survey/(?P\d+)/$', 'survey.views.SurveyDetail', name='survey_detail'), url(r'^confirm/(?P\w+)/$', 'survey.views.Confirm', name='confirmation'), - url(r'^privacy/$', 'survey.views.privacy', name='privacy_statement'), - - - # Uncomment the admin/doc line below to enable admin documentation: - url(r'^admin/doc/', include('django.contrib.admindocs.urls')), - - # Uncomment the next line to enable the admin: - url(r'^admin/', include(admin.site.urls)), -) - -# media url hackery. le sigh. -urlpatterns += patterns('', - (r'^%s/(?P.*)$' % media_url, 'django.views.static.serve', - { 'document_root': settings.MEDIA_ROOT, 'show_indexes':True }), ) - diff --git a/survey/views.py b/survey/views.py index 7ebdf7c5..4295cc35 100644 --- a/survey/views.py +++ b/survey/views.py @@ -12,7 +12,8 @@ def Index(request): - return render(request, 'index.html') + surveys = Survey.objects.all() + return render(request, 'survey/index.html', {'surveys': surveys}) def SurveyDetail(request, id): survey = Survey.objects.get(id=id) @@ -24,18 +25,16 @@ def SurveyDetail(request, id): form = ResponseForm(request.POST, survey=survey) if form.is_valid(): response = form.save() - return HttpResponseRedirect("/confirm/%s" % response.interview_uuid) + return HttpResponseRedirect( + urlresolvers.reverse('confirmation', kwargs={'uuid': response.interview_uuid})) else: form = ResponseForm(survey=survey) print form # TODO sort by category - return render(request, 'survey.html', {'response_form': form, 'survey': survey, 'categories': categories}) + return render(request, 'survey/survey.html', {'response_form': form, 'survey': survey, 'categories': categories}) def Confirm(request, uuid): email = settings.support_email - return render(request, 'confirm.html', {'uuid':uuid, "email": email}) - -def privacy(request): - return render(request, 'privacy.html') + return render(request, 'survey/confirm.html', {'uuid':uuid, "email": email}) diff --git a/templates/base.html b/templates/base.html deleted file mode 100644 index 91ec6bc7..00000000 --- a/templates/base.html +++ /dev/null @@ -1,63 +0,0 @@ - - - - - Embassy Network - - - - - - - - - - - - - - - - - - - - - - - - - {% block wrapper %} -
- {% endblock %} - -
- {% block body %} - {% endblock %} - -
-
-
- -
-
- {% block footer %} - {% endblock %} - -
- - - - - - - {% block extrajs %} - {% endblock %} - - - diff --git a/templates/index.html b/templates/index.html deleted file mode 100644 index 707a1b8c..00000000 --- a/templates/index.html +++ /dev/null @@ -1,22 +0,0 @@ -{% extends 'base.html' %} - -{% block body %} - -
-

Welcome to the Coliving Census

- -
-

We’re interested in understanding the ecosystem and archetypes of the coliving movement, in order to make it easier to start and operate coliving houses, and to create a picture of the amazing spectrum of these spaces.

- -

Similar to the way the US government does a census of the US population every few years, we are undertaking a “Coliving Census,” to capture the diversity, challenges, and opportunities of these spaces. The result will be aggregated into an anonymized, open data set about coliving spaces, as well as a report going into more detail.

- -

This is an entirely not-for-profit, community initiative, motivated by a belief that there are more and better ways to live than the nuclear family. We want to get a better picture of the communities making this happen.

-
- - -
- -{% endblock %} diff --git a/templates/privacy.html b/templates/privacy.html deleted file mode 100644 index d709935b..00000000 --- a/templates/privacy.html +++ /dev/null @@ -1,23 +0,0 @@ -{% extends 'base.html' %} - -{% block body %} - -

We are passionate about the coliving movement and embrace a collaborative approach to projects. Our hope is to be able to share the information we find with other houses, as well as use it ourselves to identify shared needs within the greater coliving community - we think this is part of the value proposition this process brings to everyone. We also have total respect for your privacy, and coliving houses are your home. All information you share can be as anonymous or open as you'd like. In particular:

- -
    -
  • Your participation in this study is completely voluntary. You do not have to answer any questions that you do not feel comfortable answering, and you may stop the interview or observation at any point during a session without penalty.
  • -
  • There are no foreseeable risks to participation in this research.
  • -We would like permission to record audio of the interview session so that what you say may be transcribed and/or reviewed to ensure accuracy. -
  • The original audio and text from the interview and any associated observations will be kept confidential to the census team and the interviewer.
  • -
  • Personally identifying information such as your personal and house names will be removed and replaced with a pseudonym.
  • -
  • A data set comprised of aggregate data from all participating houses will be compiled and made publicly available.
  • -
  • You of course MAY elect to make certain answers or information about your individual house public, but that is not required. If there is an opportunity for doing so, we will lay out the structure and implications with you explicitly.
  • -
  • We will be compiling a written report to accompany the aggregate data set. We may wish to use certain quotes or data points specific to your community in this report. If this is the case, you will be consulted for permission before publication. -Information and experiences related to legal challenges and ambiguities associated with running a coliving house will be kept in the strictest confidence.
  • -
  • Data will be stored in a web application running on a server. Access to the server is protected with key-based secure logins and the web application is password-protected.
  • -
  • The software used for this survey is open source and can be retrieved and examined at https://github.com/jessykate/django-survey
  • -
- -

You do not have to answer any questions that you do not feel comfortable answering, and you may stop the interview or observation at any point during a session without penalty. Feel free to ask any questions before, during, or after the session, either in person or via email at survey@coliving.org

- -{% endblock %} \ No newline at end of file diff --git a/templates/survey.html b/templates/survey.html deleted file mode 100644 index d7be1c2d..00000000 --- a/templates/survey.html +++ /dev/null @@ -1,97 +0,0 @@ -{% extends 'base.html' %} -{% load survey_extras %} - -{% block body %} - -

Welcome to {{survey.name|title}}

-
- {{survey.description|safe}} -
- -
-
{% csrf_token %} - -

Response Metadata

-
- -
- {{ response_form.interviewer.errors }} - * {{ response_form.interviewer.label_tag }} - {{ response_form.interviewer.help_text}} -
- {{ response_form.interviewer }} -
-
- -
- {{ response_form.interviewee.errors }} - * {{ response_form.interviewee.label_tag }} - {{ response_form.interviewee.help_text}} -
- {{ response_form.interviewee }} -
-
- -
- {{ response_form.conditions.errors }} - {{ response_form.conditions.label_tag }} - {{ response_form.conditions.help_text}} -
- {{ response_form.conditions }} -
-
- -
- {{ response_form.comments.errors }} - {{ response_form.comments.label_tag }} - {{ response_form.comments.help_text}} -
- {{ response_form.comments }} -
-
-
- -
    - {% for category in categories %} -

    {{category|title}} Questions

    -
    - {% for field in response_form %} - {% if field.field.widget.attrs.category == category %} -
  1. - {% if field.field.required %} -
    - {{ field.errors }} - * - {% else %} -
    - {{ field.errors }} - - {% endif %} - {{ field.help_text}} -
    - {{ field }} -
    -
    -
  2. - {% endif %} - {% endfor %} -
    - {% endfor %} -
- -
-
- -
- -{% endblock %} - -{% block extrajs %} - - -{% endblock %} \ No newline at end of file