summaryrefslogtreecommitdiff
path: root/papillon
diff options
context:
space:
mode:
Diffstat (limited to 'papillon')
-rw-r--r--papillon/local_settings.py.sample38
-rw-r--r--papillon/polls/feeds.py14
-rw-r--r--papillon/settings.py (renamed from papillon/settings.py.tpl)34
-rw-r--r--papillon/templates/base.html2
-rw-r--r--papillon/urls.py9
5 files changed, 67 insertions, 30 deletions
diff --git a/papillon/local_settings.py.sample b/papillon/local_settings.py.sample
new file mode 100644
index 0000000..8070842
--- /dev/null
+++ b/papillon/local_settings.py.sample
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+# copy this file to local_settings.py and modify it to your needs
+
+DEBUG=False
+
+import os
+PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
+
+# Make this unique, and don't share it with anybody.
+SECRET_KEY = 'replace_this_with_something_else'
+
+# if you have set an EXTRA_URL set the full path
+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
+
+ADMINS = (
+ # ('Your Name', 'your_email@domain.com'),
+)
+
+MANAGERS = ADMINS
+
+DATABASES = {
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': PROJECT_PATH + '/papillon.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.
+ }
+}
diff --git a/papillon/polls/feeds.py b/papillon/polls/feeds.py
index 126dbe0..b062590 100644
--- a/papillon/polls/feeds.py
+++ b/papillon/polls/feeds.py
@@ -21,17 +21,19 @@ import time
from django.core.urlresolvers import reverse
from django.core.exceptions import ObjectDoesNotExist
-from django.contrib.syndication.feeds import Feed
+from django.contrib.syndication.views import Feed
from django.utils.translation import gettext_lazy as _
+from django.utils.safestring import mark_safe
from papillon.polls.models import Poll, Vote, Voter
class PollLatestEntries(Feed):
- def get_object(self, poll_url):
+ def get_object(self, request, poll_url):
+ self.request = request
if len(poll_url) < 1:
raise ObjectDoesNotExist
- return Poll.objects.get(base_url=poll_url[0])
+ return Poll.objects.get(base_url=poll_url)
def title(self, obj):
return _("Papillon - poll : ") + obj.name
@@ -44,7 +46,7 @@ class PollLatestEntries(Feed):
return uri
def description(self, obj):
- return obj.description
+ return mark_safe(obj.description)
def item_link(self, voter):
url = reverse('poll', args=[voter.poll.base_url])
@@ -55,6 +57,6 @@ class PollLatestEntries(Feed):
return url
def items(self, obj):
- voters = Voter.objects.filter(poll__id=obj.id).\
-order_by('-modification_date')[:10]
+ voters = Voter.objects.filter(poll=obj
+ ).order_by('-modification_date')[:10]
return voters
diff --git a/papillon/settings.py.tpl b/papillon/settings.py
index cecfb45..49b46c5 100644
--- a/papillon/settings.py.tpl
+++ b/papillon/settings.py
@@ -2,11 +2,12 @@
# -*- coding: utf-8 -*-
# Django settings for papillon project.
+# Don't edit this file. Put your changes in local_settings.py
-DEBUG = True
+DEBUG = False
TEMPLATE_DEBUG = DEBUG
-import os.path
+import os
PROJECT_PATH = os.path.dirname(os.path.abspath(__file__))
EXTRA_URL = 'papillon/'
@@ -25,17 +26,15 @@ MANAGERS = ADMINS
DATABASES = {
'default': {
- 'ENGINE': 'sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
- 'NAME': PROJECT_PATH + '/papillon.db', # Or path to database file if using sqlite3.
- 'USER': 'postgres', # 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.
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': PROJECT_PATH + '/papillon.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://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
# although not all variations may be possible on all operating systems.
@@ -67,16 +66,14 @@ MEDIA_URL = '/static/'
# trailing slash.
# Examples: "http://foo.com/media/", "/media/".
# if you have set an EXTRA_URL set the full path
-ADMIN_MEDIA_PREFIX = '/media/'
+ADMIN_MEDIA_PREFIX = '/static/admin/'
-# Make this unique, and don't share it with anybody.
-SECRET_KEY = 'replace_this_with_something_else'
+SECRET_KEY = ''
# List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = (
- 'django.template.loaders.filesystem.load_template_source',
- 'django.template.loaders.app_directories.load_template_source',
-# 'django.template.loaders.eggs.load_template_source',
+ 'django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader',
)
MIDDLEWARE_CLASSES = (
@@ -116,3 +113,8 @@ LANGUAGES = (
('fr', 'Français'),
('en', 'English'),
)
+
+try:
+ from local_settings import *
+except ImportError, e:
+ print 'Unable to load local_settings.py:', e
diff --git a/papillon/templates/base.html b/papillon/templates/base.html
index 30b1bf3..df72339 100644
--- a/papillon/templates/base.html
+++ b/papillon/templates/base.html
@@ -19,7 +19,7 @@
{% block content %}{% endblock %}
</div>
<div id="footer">
-<a href='http://blog.peacefrogs.net/nim/papillon/'>Papillon</a> - <a href='http://www.gnu.org/licenses/gpl.html'>Copyright</a> © 2008-2011 <a href='http://redmine.peacefrogs.net/projects/show/papillon'>Papillon project</a>
+<a href='http://blog.peacefrogs.net/nim/papillon/'>Papillon</a> - <a href='http://www.gnu.org/licenses/gpl.html'>Copyright</a> © 2008-2013 <a href='http://redmine.peacefrogs.net/projects/show/papillon'>Papillon project</a>
</div>
</div>
</body>
diff --git a/papillon/urls.py b/papillon/urls.py
index 862f66a..e0e9ed6 100644
--- a/papillon/urls.py
+++ b/papillon/urls.py
@@ -25,10 +25,6 @@ admin.autodiscover()
from polls.feeds import PollLatestEntries
-feeds = {
- 'poll': PollLatestEntries,
-}
-
base = '^' + settings.EXTRA_URL
if settings.EXTRA_URL and not base.endswith('/'):
base += '/'
@@ -37,7 +33,7 @@ urlpatterns = patterns('',
(base + r'admin/doc/', include('django.contrib.admindocs.urls')),
url(base + r'admin/jsi18n/$', 'django.views.i18n.javascript_catalog',
name='admin_i18n'),
- (base + r'admin/(.*)', admin.site.root),
+ url(base + r'^admin/', include(admin.site.urls)),
url(base + r'$', 'papillon.polls.views.index', name='index'),
url(base + r'create/$', 'papillon.polls.views.create', name='create'),
url(base + r'edit/(?P<admin_url>\w+)/$',
@@ -52,8 +48,7 @@ urlpatterns = patterns('',
name='poll'),
url(base + r'poll/(?P<poll_url>\w+)/vote/$', 'papillon.polls.views.poll',
name='vote'),
- url(base + r'feeds/(?P<url>.*)$', 'django.contrib.syndication.views.feed',
- {'feed_dict': feeds}, name='feed'),
+ url(base + r'feeds/poll/(?P<poll_url>\w+)$', PollLatestEntries(), name='feed'),
(base + r'static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.PROJECT_PATH + '/static'}),
(base + r'media/(?P<path>.*)$', 'django.views.static.serve',