Skip to content

Commit

Permalink
switch to proper directory structure
Browse files Browse the repository at this point in the history
  • Loading branch information
thraxil committed Dec 12, 2013
1 parent 9636a88 commit 7d1cc95
Show file tree
Hide file tree
Showing 171 changed files with 212 additions and 225 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 2 additions & 18 deletions carr_main/admin.py → carr/carr_main/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
from models import SiteSection
from models import Section
from pagetree.models import SectionChildren, PageBlock
from django.contrib.flatpages.models import FlatPage
from django.contrib.flatpages.admin import FlatPageAdmin as FlatPageAdminOld


class SectionChildrenInline(admin.StackedInline):
Expand All @@ -20,13 +18,10 @@ class PageBlockInline(admin.StackedInline):
fields = ('label', )
template = 'admin/pagetree/pageblock/edit_inline/stacked.html'

#import pdb
# pdb.set_trace()


class SectionAdmin(admin.ModelAdmin):
list_display = ('label', 'slug', 'template')
fields = ('label', 'slug', 'template', 'sites')
list_display = ('label', 'slug')
fields = ('label', 'slug', 'sites')

inlines = [
SectionChildrenInline,
Expand All @@ -35,14 +30,3 @@ class SectionAdmin(admin.ModelAdmin):

admin.site.unregister(Section)
admin.site.register(SiteSection, SectionAdmin)


class FlatPageAdmin(FlatPageAdminOld):

class Media:
js = ('js/tiny_mce/tiny_mce.js',
'js/tiny_mce/textareas.js',)

# We have to unregister it, and then reregister
admin.site.unregister(FlatPage)
admin.site.register(FlatPage, FlatPageAdmin)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 7 additions & 7 deletions carr_main/views.py → carr/carr_main/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
from django.shortcuts import render_to_response
from pagetree.models import Hierarchy
from django.contrib.auth.decorators import login_required
from carr_main.models import SiteState, sort_users
from .models import SiteState, sort_users
from django.contrib.sites.models import Site
from quiz.models import Question
from activity_taking_action.models import score_on_taking_action
from activity_bruise_recon.models import score_on_bruise_recon
from quiz.scores import (score_on_all_quizzes, all_answers_for_quizzes,
scores_student, training_is_complete)
from carr.quiz.models import Question
from carr.activity_taking_action.models import score_on_taking_action
from carr.activity_bruise_recon.models import score_on_bruise_recon
from carr.quiz.scores import (score_on_all_quizzes, all_answers_for_quizzes,
scores_student, training_is_complete)
from django.conf import settings
from django.contrib.auth.decorators import user_passes_test
from quiz.scores import can_see_scores
from carr.quiz.scores import can_see_scores

import re

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions quiz/scores.py → carr/quiz/scores.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
from django.utils import simplejson
from django.contrib.auth.models import User, Group
from django.contrib.sites.models import Site
from .carr_main.models import students_in_class, users_by_uni
from .activity_taking_action.models import score_on_taking_action
from .activity_bruise_recon.models import score_on_bruise_recon
from carr.carr_main.models import students_in_class, users_by_uni
from carr.activity_taking_action.models import score_on_taking_action
from carr.activity_bruise_recon.models import score_on_bruise_recon
from django.core.cache import cache
from django.conf import settings
from itertools import tee, izip
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions settings.py → carr/settings.py
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
# flake8: noqa
from settings_shared import *
1 change: 1 addition & 0 deletions settings_dental.py → carr/settings_dental.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# flake8: noqa
SITE_ID = 1
from settings_shared import *
104 changes: 53 additions & 51 deletions settings_shared.py → carr/settings_shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,23 @@
DEBUG = True
TEMPLATE_DEBUG = DEBUG

DATABASE_ENGINE = 'postgresql_psycopg2' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_NAME = 'carr' # Or path to database file if using sqlite3.
DATABASE_USER = 'pusher' # Not used with sqlite3.
DATABASE_USER = 'eddie' # Not used with sqlite3.
# 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
DATABASE_ENGINE = 'postgresql_psycopg2'
DATABASE_NAME = 'carr' # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
# Set to empty string for localhost. Not used with sqlite3.
DATABASE_HOST = ''
# Set to empty string for default. Not used with sqlite3.
DATABASE_PORT = ''

ALLOWED_HOSTS = [".ccnmtl.columbia.edu", "localhost", ]

ADMINS = ()

if 'test' in sys.argv:
DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = ':memory:' # Or path to database file if using sqlite3.
DATABASE_NAME = ':memory:' # Or path to database file if using sqlite3.
ADMINS = ()

SOUTH_TESTS_MIGRATE = False
Expand All @@ -27,11 +31,11 @@

NOSE_ARGS = [
'--with-coverage',
'--cover-package=carr_main,activity_bruise_recon,activity_taking_action,quiz',
'--cover-package=carr',
]


#For now turn off caching
# For now turn off caching
CACHE_BACKEND = 'locmem://'
#CACHE_BACKEND = 'dummy://'

Expand Down Expand Up @@ -70,17 +74,13 @@
ROOT_URLCONF = 'carr.urls'

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.
# Put application templates before these fallback ones:
"/var/www/carr/templates/",
os.path.join(os.path.dirname(__file__),"templates"),
"/var/www/carr/carr/templates/",
os.path.join(os.path.dirname(__file__), "templates"),
)

INSTALLED_APPS = [
'activity_bruise_recon',
'activity_taking_action',
'carr.activity_bruise_recon',
'carr.activity_taking_action',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
Expand All @@ -89,24 +89,19 @@
'django.contrib.sites',
'pageblocks',
'pagetree',
'carr_main',
'quiz',
'carr.carr_main',
'carr.quiz',
'smartif',
'sorl.thumbnail',
'template_utils',
'tinymce',
'typogrify',
'courseaffils',
'deploy_specific',
'django_statsd',
'south',
'django_nose',
]

if 'test' in sys.argv:
# should not be required for tests
INSTALLED_APPS.remove('deploy_specific')

STATSD_CLIENT = 'statsd.client'
STATSD_PREFIX = 'carr'
STATSD_HOST = 'localhost'
Expand All @@ -116,7 +111,7 @@

THUMBNAIL_SUBDIR = "thumbs"

# for AuthRequirementMiddleware. this should be a list of
# for AuthRequirementMiddleware. this should be a list of
# url prefixes for paths that can be accessed by anonymous
# users. we need to allow anonymous access to the login
# page, and to static resources.
Expand All @@ -131,48 +126,55 @@
)

COURSEAFFILS_PATHS = (
#'/carr/',
#'/activity/',
#re.compile(r'^/$'),
)
#'/carr/',
#'/activity/',
# re.compile(r'^/$'),
)

NON_ANONYMOUS_PATHS = COURSEAFFILS_PATHS

COURSEAFFILS_EXEMPT_PATHS = ANONYMOUS_PATHS
COURSEAFFIL_AUTO_MAP_GROUPS = ['demo']

DEFAULT_SOCIALWORK_FACULTY_USER_IDS = [ 14, 21, 30, 41, 44, 456, 1514, 1515, 1516 ]

DEFAULT_SOCIALWORK_FACULTY_USER_IDS = [
14,
21,
30,
41,
44,
456,
1514,
1515,
1516]

WIND_BASE = "https://wind.columbia.edu/"
WIND_SERVICE = "cnmtl_full_np"
WIND_PROFILE_HANDLERS = ['djangowind.auth.CDAPProfileHandler']
WIND_AFFIL_HANDLERS = [
'djangowind.auth.AffilGroupMapper', 'djangowind.auth.StaffMapper',
'djangowind.auth.SuperuserMapper']
WIND_STAFF_MAPPER_GROUPS = ['tlc.cunix.local:columbia.edu']
WIND_SUPERUSER_MAPPER_GROUPS = ['anp8', 'jb2410', 'zm4', 'egr2107']

# WIND settings
AUTHENTICATION_BACKENDS = ('djangowind.auth.WindAuthBackend','django.contrib.auth.backends.ModelBackend',)
AUTHENTICATION_BACKENDS = (
'djangowind.auth.WindAuthBackend',
'django.contrib.auth.backends.ModelBackend',
)


# Pageblocks/Pagetree settings
# Pageblocks/Pagetree settings
PAGEBLOCKS = ['pageblocks.HTMLBlock',
'pageblocks.PullQuoteBlock',
'carr_main.PullQuoteBlock_2',
'carr_main.PullQuoteBlock_3',
'pageblocks.ImageBlock',
'carr_main.FlashVideoBlock',
'quiz.Quiz',
'activity_bruise_recon.Block',
'carr.carr_main.FlashVideoBlock',
'carr.quiz.Quiz',
'activity_bruise_recon.Block',
'activity_taking_action.Block',
#'activity_treatment_choice.Block',
#'activity_prescription_writing.Block',
#this appears to be breaking stuff:
#'carr_main.FlashVideoBlock'
]


#if you add a 'deploy_specific' directory
#then you can put a settings.py file and templates/ overrides there
try:
from deploy_specific.settings import *
if locals().has_key('EXTRA_INSTALLED_APPS'):
INSTALLED_APPS = EXTRA_INSTALLED_APPS + INSTALLED_APPS
except ImportError:
pass
]


SITE_ID = 1
MANAGERS = ADMINS
1 change: 1 addition & 0 deletions settings_socialwork.py → carr/settings_socialwork.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# flake8: noqa
SITE_ID = 2
from settings_shared import *
37 changes: 37 additions & 0 deletions carr/someutils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!ve/bin/python

try:
from django.conf import settings
from django.contrib.auth import REDIRECT_FIELD_NAME
from django.utils.http import urlquote
from django.http import HttpResponseRedirect

def match_path(path, config_string):
config_list = getattr(settings, config_string, [])
for p in config_list:
if isinstance(p, str) and path.startswith(p):
return True
elif hasattr(p, 'match') and p.match(path):
return True
return False

class AuthRequirementMiddleware(object):

def process_request(self, request):
path = urlquote(request.get_full_path())
if request.user.is_authenticated():
return None

if match_path(path, 'ANONYMOUS_PATHS'):
return None
if hasattr(settings, 'NON_ANONYMOUS_PATHS') \
and not match_path(path, 'NON_ANONYMOUS_PATHS'):
return None

return HttpResponseRedirect('%s?%s=%s' % (
settings.LOGIN_URL,
REDIRECT_FIELD_NAME,
path))

except ImportError:
pass
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% extends section.template %}
{% extends "base.html" %}

{% block title %}{{section.label}}{% endblock %}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 7d1cc95

Please sign in to comment.