summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAna <ana.charpentier@free.fr>2016-04-18 18:13:31 +0200
committerAna <ana.charpentier@free.fr>2016-04-18 18:13:31 +0200
commitd2f081150f45707238bf2f6978b3d8da423fd323 (patch)
tree6e203cb1260023bae8b8884013d79124a340ee47
parent564379c0aea3106490d27e239567134d42325c30 (diff)
downloadPapillon-d2f081150f45707238bf2f6978b3d8da423fd323.tar.bz2
Papillon-d2f081150f45707238bf2f6978b3d8da423fd323.zip
beaucoup de modifs dans le fichier settings.py
basé sur le fichier de settings de django 1.7 modifs sur models : unicode devient __str__
-rw-r--r--papillon/papillon/settings.py180
-rw-r--r--papillon/polls/admin.py2
-rw-r--r--papillon/polls/forms.py2
-rw-r--r--papillon/polls/models.py6
4 files changed, 119 insertions, 71 deletions
diff --git a/papillon/papillon/settings.py b/papillon/papillon/settings.py
index 7a32140..ff043c0 100644
--- a/papillon/papillon/settings.py
+++ b/papillon/papillon/settings.py
@@ -4,32 +4,89 @@
# Django settings for papillon project.
# Don't edit this file. Put your changes in local_settings.py
-DEBUG = False
-TEMPLATE_DEBUG = DEBUG
+
import os
+BASE_DIR = os.path.dirname(os.path.dirname(__file__))
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
-EXTRA_URL = ''
-STATIC_URL = '/static/'
+# Quick-start development settings - unsuitable for production
+# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
-TINYMCE_URL = 'http://localhost/tinymce/'
-MAX_COMMENT_NB = 10 # max number of comments by poll - 0 to disable comments
-ALLOW_FRONTPAGE_POLL = False # disabled is recommanded for public instance
-# time to live in days
-DAYS_TO_LIVE = 30
+# SECURITY WARNING: keep the secret key used in production secret!
+SECRET_KEY = 'lpmtkrbugm0=t*kgl94-!pm38ua925o0yvzjc!=*mct-1r(io+'
-STATICFILES_DIRS = [
- os.path.join(PROJECT_PATH, "static"),
-]
+# SECURITY WARNING: don't run with debug turned on in production!
-ADMINS = (
- # ('Your Name', 'your_email@domain.com'),
+DEBUG = False
+TEMPLATE_DEBUG = DEBUG
+
+ALLOWED_HOSTS = []
+
+# Application definition
+
+
+
+
+
+
+TEMPLATES = [
+ {
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [os.path.join(BASE_DIR, 'templates\\')],
+ 'APP_DIRS': True,
+ 'OPTIONS': {
+ 'context_processors': [
+ 'django.template.context_processors.debug',
+ 'django.template.context_processors.request',
+ 'django.contrib.auth.context_processors.auth',
+ 'django.contrib.messages.context_processors.messages',
+ ],
+ },
+ },
+INSTALLED_APPS = (
+ # contribs
+ 'django.contrib.staticfiles',
+ 'django.contrib.auth',
+ 'django.contrib.admin',
+ 'django.contrib.contenttypes',
+ 'django.contrib.sessions',
+ 'django.contrib.sites',
+ 'django.contrib.messages',
+
+
+
+
+ # app
+ 'polls',
)
-MANAGERS = ADMINS
+MIDDLEWARE_CLASSES = (
+ 'django.contrib.sessions.middleware.SessionMiddleware',
+ 'django.middleware.common.CommonMiddleware',
+ 'django.middleware.csrf.CsrfViewMiddleware',
+ 'django.middleware.locale.LocaleMiddleware',
+ 'django.contrib.auth.middleware.AuthenticationMiddleware',
+ 'django.contrib.auth.middleware.SessionAuthenticationMiddleware',#// nouveau depuis 1.7
+ 'django.contrib.messages.middleware.MessageMiddleware',
+ 'django.middleware.clickjacking.XFrameOptionsMiddleware',
+)
+
+ROOT_URLCONF = 'papillon.urls'
+WSGI_APPLICATION = 'papillon.wsgi.application'
+
+TEMPLATE_DIRS = (
+ os.path.join(BASE_DIR, 'templates'),
+)
+
+
+
+
+
+# Database
+# https://docs.djangoproject.com/en/1.7/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
@@ -37,6 +94,31 @@ DATABASES = {
}
}
+# Internationalization
+# https://docs.djangoproject.com/en/1.7/topics/i18n/
+
+
+# Language code for this installation. All choices can be found here:
+# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
+# http://blogs.law.harvard.edu/tech/stories/storyReader$15
+LANGUAGE_CODE = 'fr-fr'
+
+# If you set this to False, Django will make some optimizations so as not
+# to load the internationalization machinery.
+USE_I18N = True
+
+USE_L10N = True
+
+USE_TZ = True
+LANGUAGES = (
+ ('fr', 'Français'),
+ ('en', 'English'),
+TEMPLATE_CONTEXT_PROCESSORS = (
+ "django.contrib.auth.context_processors.auth",
+ "django.core.context_processors.i18n",
+)
+)
+
# Local time zone for this installation. Choices can be found here:
# http://www.postgresql.org/docs/8.1/static/datetime-keywords.html
# #DATETIME-TIMEZONE-SET-TABLE
@@ -45,75 +127,41 @@ DATABASES = {
# system time zone.
TIME_ZONE = 'Europe/Paris'
-# Language code for this installation. All choices can be found here:
-# http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
-# http://blogs.law.harvard.edu/tech/stories/storyReader$15
-LANGUAGE_CODE = 'fr-fr'
+# Static files (CSS, JavaScript, Images)
+# https://docs.djangoproject.com/en/1.7/howto/static-files/
-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
-# Absolute path to the directory that holds media.
-# Example: "/home/media/media.lawrence.com/"
-MEDIA_ROOT = PROJECT_PATH + '/media/'
+STATIC_URL = '/static/'
-# URL that handles the media served from MEDIA_ROOT.
-# Example: "http://media.lawrence.com"
-# if you have set an EXTRA_URL set the full path
-MEDIA_URL = '/static/'
+LOCALE_PATHS = (
+ os.path.join(BASE_DIR, 'locale/'),
+ )
+
# URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
# if you have set an EXTRA_URL set the full path
ADMIN_MEDIA_PREFIX = '/static/admin/'
+EXTRA_URL = ''
+TINYMCE_URL = 'http://localhost/tinymce/'
+MAX_COMMENT_NB = 10 # max number of comments by poll - 0 to disable comments
+ALLOW_FRONTPAGE_POLL = False # disabled is recommanded for public instance
+# time to live in days
+DAYS_TO_LIVE = 30
-SECRET_KEY = ''
-# 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',
-)
-
-MIDDLEWARE_CLASSES = (
- 'django.middleware.common.CommonMiddleware',
- 'django.contrib.sessions.middleware.SessionMiddleware',
- 'django.middleware.locale.LocaleMiddleware',
- 'django.contrib.auth.middleware.AuthenticationMiddleware',
- 'django.middleware.doc.XViewMiddleware',
+ADMINS = (
+ # ('Your Name', 'your_email@domain.com'),
)
-ROOT_URLCONF = 'papillon.urls'
-
-TEMPLATE_DIRS = (
- PROJECT_PATH + '/templates',
-)
+MANAGERS = ADMINS
-INSTALLED_APPS = (
- # contribs
- 'django.contrib.staticfiles',
- 'django.contrib.auth',
- 'django.contrib.admin',
- 'django.contrib.contenttypes',
- 'django.contrib.sessions',
- 'django.contrib.sites',
- 'django.contrib.markup',
- # third parties
- 'south',
- # app
- 'papillon.polls',
-)
+SITE_ID = 1
-LANGUAGES = (
- ('fr', 'Français'),
- ('en', 'English'),
-)
try:
from local_settings import *
diff --git a/papillon/polls/admin.py b/papillon/polls/admin.py
index a5021b6..7153a2e 100644
--- a/papillon/polls/admin.py
+++ b/papillon/polls/admin.py
@@ -21,7 +21,7 @@
Settings for administration pages
"""
-from papillon.polls.models import Poll, Category
+from polls.models import Poll, Category
from django.contrib import admin
diff --git a/papillon/polls/forms.py b/papillon/polls/forms.py
index 359410d..ac1e68c 100644
--- a/papillon/polls/forms.py
+++ b/papillon/polls/forms.py
@@ -27,7 +27,7 @@ from django import forms
from django.contrib.admin import widgets as adminwidgets
from django.utils.translation import gettext_lazy as _
-from papillon.polls.models import Poll, Category, Choice, Comment
+from polls.models import Poll, Category, Choice, Comment
from django.conf import settings
diff --git a/papillon/polls/models.py b/papillon/polls/models.py
index 506ad79..aa6510a 100644
--- a/papillon/polls/models.py
+++ b/papillon/polls/models.py
@@ -33,7 +33,7 @@ class Category(models.Model):
name = models.CharField(max_length=100)
description = models.TextField()
- def __unicode__(self):
+ def __str__(self):
return self.name
@@ -145,7 +145,7 @@ the poll/check this option to reopen it"))
class Meta:
ordering = ['-modification_date']
- def __unicode__(self):
+ def __str__(self):
return self.name
@@ -169,7 +169,7 @@ class Voter(models.Model):
class Meta:
ordering = ['creation_date']
- def __unicode__(self):
+ def __str__(self):
return _("Vote from %(user)s") % {'user': self.user.name}
def getVotes(self, choice_ids):