diff options
Diffstat (limited to 'papillon')
-rw-r--r-- | papillon/polls/feeds.py | 13 | ||||
-rw-r--r-- | papillon/polls/views.py | 6 | ||||
-rw-r--r-- | papillon/settings.py.tpl | 8 | ||||
-rw-r--r-- | papillon/templates/edit.html | 6 |
4 files changed, 22 insertions, 11 deletions
diff --git a/papillon/polls/feeds.py b/papillon/polls/feeds.py index 5c11b9c..126dbe0 100644 --- a/papillon/polls/feeds.py +++ b/papillon/polls/feeds.py @@ -19,11 +19,11 @@ import time +from django.core.urlresolvers import reverse from django.core.exceptions import ObjectDoesNotExist from django.contrib.syndication.feeds import Feed from django.utils.translation import gettext_lazy as _ -from papillon.settings import BASE_SITE from papillon.polls.models import Poll, Vote, Voter @@ -39,14 +39,19 @@ class PollLatestEntries(Feed): def link(self, obj): if not obj: raise FeedDoesNotExist - return BASE_SITE + "/poll/" + obj.base_url + uri = self.request.build_absolute_uri(reverse('poll', + args=[obj.base_url])) + return uri def description(self, obj): return obj.description def item_link(self, voter): - url = "%s/poll/%s_%d" % (BASE_SITE, voter.poll.base_url, - time.mktime(voter.modification_date.timetuple())) + url = reverse('poll', args=[voter.poll.base_url]) + url = self.request.build_absolute_uri(reverse('poll', + args=[voter.poll.base_url])) + url = "%s_%d" % (url[:-1], # dirty... + time.mktime(voter.modification_date.timetuple())) return url def items(self, obj): diff --git a/papillon/polls/views.py b/papillon/polls/views.py index 26b3b34..43ff37f 100644 --- a/papillon/polls/views.py +++ b/papillon/polls/views.py @@ -133,6 +133,12 @@ def edit(request, admin_url): form = Form(instance=poll) response_dct['form'] = form response_dct['poll'] = poll + response_dct['base_url'] = request.build_absolute_uri(reverse('poll', + args=[poll.base_url])) + response_dct['edit_url'] = request.build_absolute_uri(reverse('edit', + args=[poll.admin_url])) + response_dct['choices_url'] = request.build_absolute_uri(reverse( + 'edit_choices_admin', args=[poll.admin_url])) return render_to_response('edit.html', response_dct) def editChoicesAdmin(request, admin_url): diff --git a/papillon/settings.py.tpl b/papillon/settings.py.tpl index f83dcb2..cecfb45 100644 --- a/papillon/settings.py.tpl +++ b/papillon/settings.py.tpl @@ -9,9 +9,7 @@ TEMPLATE_DEBUG = DEBUG import os.path PROJECT_PATH = os.path.dirname(os.path.abspath(__file__)) -SERVER_URL = 'http://localhost/' EXTRA_URL = 'papillon/' -BASE_SITE = SERVER_URL + EXTRA_URL TINYMCE_URL = 'http://localhost/tinymce/' MAX_COMMENT_NB = 10 # max number of comments by poll - 0 to disable comments @@ -62,12 +60,14 @@ MEDIA_ROOT = PROJECT_PATH + '/static/' # URL that handles the media served from MEDIA_ROOT. # Example: "http://media.lawrence.com" -MEDIA_URL = BASE_SITE + 'static/' +# if you have set an EXTRA_URL set the full path +MEDIA_URL = '/static/' # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a # trailing slash. # Examples: "http://foo.com/media/", "/media/". -ADMIN_MEDIA_PREFIX = BASE_SITE + 'media/' +# if you have set an EXTRA_URL set the full path +ADMIN_MEDIA_PREFIX = '/media/' # Make this unique, and don't share it with anybody. SECRET_KEY = 'replace_this_with_something_else' diff --git a/papillon/templates/edit.html b/papillon/templates/edit.html index b2b38a5..2f77a7e 100644 --- a/papillon/templates/edit.html +++ b/papillon/templates/edit.html @@ -16,7 +16,7 @@ <tr> <td><label>{% trans "Poll url" %}</label></td> <td> -<a href='{% url poll poll.base_url%}'>{% url poll poll.base_url%}</a> +<a href='{% url poll poll.base_url%}'>{{ base_url }}</a> </td> <td class='form_description'><p> {% trans "Copy this address and send it to voters who want to participate to this poll" %} @@ -25,7 +25,7 @@ <tr> <td><label>{% trans "Administration url" %}</label></td> <td> -<a href='{% url edit poll.admin_url %}'>{% url edit poll.admin_url %}</a> +<a href='{% url edit poll.admin_url %}'>{{ edit_url }}</a> </td> <td class='form_description'><p> {% trans "Address to modify the current poll" %} @@ -34,7 +34,7 @@ <tr> <td><label>{% trans "Choices administration url" %}</label></td> <td> -<a href='{% url edit_choices_admin poll.admin_url %}'>{% url edit_choices_admin poll.admin_url %}</a> +<a href='{% url edit_choices_admin poll.admin_url %}'>{{choices_url }}</a> </td> <td class='form_description'><p> {% trans "Address to modify choices of the current poll." %} |