diff options
-rw-r--r-- | papillon/polls/forms.py | 2 | ||||
-rw-r--r-- | papillon/polls/models.py | 6 | ||||
-rw-r--r-- | papillon/polls/views.py | 14 | ||||
-rw-r--r-- | papillon/settings.py | 6 | ||||
-rw-r--r-- | papillon/templates/base.html | 4 |
5 files changed, 19 insertions, 13 deletions
diff --git a/papillon/polls/forms.py b/papillon/polls/forms.py index b97c966..359410d 100644 --- a/papillon/polls/forms.py +++ b/papillon/polls/forms.py @@ -37,7 +37,7 @@ class TextareaWidget(forms.Textarea): """ class Media: js = ["%stiny_mce.js" % settings.TINYMCE_URL, - "%stextareas.js" % settings.MEDIA_URL] + "%stextareas.js" % settings.STATIC_URL] class PollForm(forms.ModelForm): diff --git a/papillon/polls/models.py b/papillon/polls/models.py index 5fe49d6..506ad79 100644 --- a/papillon/polls/models.py +++ b/papillon/polls/models.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2008-2011 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2008-2016 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as @@ -87,8 +87,8 @@ different choices help_text=_("Check this option to make the poll public")) opened_admin = models.BooleanField( default=False, verbose_name=_("Allow users to add choices"), - help_text=_(u"Check this option to open the poll to new choices " - u"submitted by users")) + help_text=_("Check this option to open the poll to new choices " + "submitted by users")) hide_choices = models.BooleanField( default=False, verbose_name=_("Hide votes to new voters"), help_text=_("Check this option to hide poll results to new users")) diff --git a/papillon/polls/views.py b/papillon/polls/views.py index eeed883..54920b7 100644 --- a/papillon/polls/views.py +++ b/papillon/polls/views.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -# Copyright (C) 2008 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> +# Copyright (C) 2008-2016 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as @@ -25,11 +25,12 @@ from random import choice as random_choice import string import time -from django.shortcuts import render_to_response -from django.http import HttpResponseRedirect +from django.core.urlresolvers import reverse from django.conf import settings +from django.http import HttpResponseRedirect +from django.shortcuts import render_to_response +from django.template import RequestContext from django.utils.translation import gettext_lazy as _ -from django.core.urlresolvers import reverse from papillon.polls.models import Poll, PollUser, Choice, Voter, Vote, \ Category, Comment @@ -50,7 +51,7 @@ def getBaseResponse(request): languages = [] for language_code, language_label in settings.LANGUAGES: languages.append((language_code, language_label)) - return {'media_url': settings.MEDIA_URL, 'languages': languages, + return {'languages': languages, 'admin_url': settings.ADMIN_MEDIA_PREFIX}, None @@ -65,7 +66,8 @@ def index(request): response_dct['categories'] = Category.objects.all() if 'bad_poll' in request.GET: response_dct['error'] = _("The poll requested don't exist (anymore?)") - return render_to_response('main.html', response_dct) + return render_to_response('main.html', response_dct, + context_instance=RequestContext(request)) def category(request, category_id): diff --git a/papillon/settings.py b/papillon/settings.py index 50973bc..7a32140 100644 --- a/papillon/settings.py +++ b/papillon/settings.py @@ -20,6 +20,10 @@ ALLOW_FRONTPAGE_POLL = False # disabled is recommanded for public instance # time to live in days DAYS_TO_LIVE = 30 +STATICFILES_DIRS = [ + os.path.join(PROJECT_PATH, "static"), +] + ADMINS = ( # ('Your Name', 'your_email@domain.com'), ) @@ -91,13 +95,13 @@ TEMPLATE_DIRS = ( INSTALLED_APPS = ( # contribs + 'django.contrib.staticfiles', 'django.contrib.auth', 'django.contrib.admin', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.markup', - 'django.contrib.staticfiles', # third parties 'south', diff --git a/papillon/templates/base.html b/papillon/templates/base.html index 16c9f14..c235686 100644 --- a/papillon/templates/base.html +++ b/papillon/templates/base.html @@ -1,8 +1,8 @@ -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" +{% load staticfiles %}<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> - <link rel="stylesheet" href="{{media_url}}styles.css" /> + <link rel="stylesheet" href="{% static 'styles.css' %}" /> <title>{% block title %}Papillon{% endblock %}</title> {% block fullscript %}{% endblock %} </head> |