summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoretienne2009-12-28 18:44:20 +0000
committeretienne2009-12-28 18:44:20 +0000
commit852d50136ca934a314712983f16ee1abeac6a19b (patch)
treef14fd7aa78bdbf1973e0992a1c806560c1aff810
parent648e765944add7137feecfa8ea139267e1ed520c (diff)
Simplification of base url management
-rw-r--r--polls/views.py4
-rw-r--r--templates/base.html4
-rw-r--r--templates/category.html2
-rw-r--r--templates/edit.html12
-rw-r--r--templates/editChoicesAdmin.html8
-rw-r--r--templates/editChoicesUser.html8
-rw-r--r--templates/vote.html10
7 files changed, 23 insertions, 25 deletions
diff --git a/polls/views.py b/polls/views.py
index 386792f..f6bc0c2 100644
--- a/polls/views.py
+++ b/polls/views.py
@@ -40,9 +40,7 @@ def getBaseResponse(request):
"""Manage basic fields for the template
If not null the second argument returned is a redirection.
"""
- #Get the root url in order to redirect to the main page
- url = "/".join([request.META['HTTP_HOST'],
- request.path.split('/')[1], ''])
+ url = BASE_SITE
# setting the current language and available languages
if 'language' in request.GET:
if request.GET['language'] in [language[0] for language in LANGUAGES]:
diff --git a/templates/base.html b/templates/base.html
index b66a341..abedf4a 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -2,7 +2,7 @@
"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="http://{{root_url}}static/styles.css" />
+ <link rel="stylesheet" href="{{root_url}}static/styles.css" />
<title>{% block title %}Papillon{% endblock %}</title>
{% block fullscript %}{% endblock %}
</head>
@@ -13,7 +13,7 @@
<span id='languages'>{% for language in languages%}<a href='?language={{language.0}}'>{{language.1}}</a>{% endfor %}</span>
</div>
<div id="top">
- <h1><a href='http://{{root_url}}'>Papillon</a></h1>
+ <h1><a href='{{root_url}}'>Papillon</a></h1>
</div>
<div id="content">
{% block content %}{% endblock %}
diff --git a/templates/category.html b/templates/category.html
index 7b26d48..0908851 100644
--- a/templates/category.html
+++ b/templates/category.html
@@ -8,7 +8,7 @@
{% if polls %}<h2>{%trans "Polls"%}</h2>{%endif%}
{% for poll in polls %}
<div class='poll-description'>
- <p><a href='http://{{root_url}}poll/{{poll.base_url}}'>{{poll.name}}</a></p>
+ <p><a href='{{root_url}}poll/{{poll.base_url}}'>{{poll.name}}</a></p>
<p>{{poll.description}}</p>
</div>
{% endfor %}
diff --git a/templates/edit.html b/templates/edit.html
index f24395f..7ef4f14 100644
--- a/templates/edit.html
+++ b/templates/edit.html
@@ -3,9 +3,9 @@
{% load i18n %}
{% block fullscript %}
-<script type="text/javascript" src="http://{{root_url}}admin/jsi18n/"></script>
-<script type="text/javascript" src="http://{{root_url}}media/js/core.js"></script>
-<script type="text/javascript" src="http://{{root_url}}media/js/admin/RelatedObjectLookups.js"></script>
+<script type="text/javascript" src="{{root_url}}admin/jsi18n/"></script>
+<script type="text/javascript" src="{{root_url}}media/js/core.js"></script>
+<script type="text/javascript" src="{{root_url}}media/js/admin/RelatedObjectLookups.js"></script>
{{ form.media }}
{% endblock %}
@@ -16,7 +16,7 @@
<tr>
<td><label>{% trans "Poll url" %}</label></td>
<td>
-<a href='http://{{root_url}}poll/{{poll.base_url}}'>http://{{root_url}}poll/{{poll.base_url}}</a>
+<a href='{{root_url}}poll/{{poll.base_url}}'>{{root_url}}poll/{{poll.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='http://{{root_url}}edit/{{poll.admin_url}}'>http://{{root_url}}edit/{{poll.admin_url}}</a>
+<a href='{{root_url}}edit/{{poll.admin_url}}'>{{root_url}}edit/{{poll.admin_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='http://{{root_url}}editChoicesAdmin/{{poll.admin_url}}'>http://{{root_url}}editChoicesAdmin/{{poll.admin_url}}</a>
+<a href='{{root_url}}editChoicesAdmin/{{poll.admin_url}}'>{{root_url}}editChoicesAdmin/{{poll.admin_url}}</a>
</td>
<td class='form_description'><p>
{% trans "Address to modify choices of the current poll." %}
diff --git a/templates/editChoicesAdmin.html b/templates/editChoicesAdmin.html
index 260d68c..a7798bf 100644
--- a/templates/editChoicesAdmin.html
+++ b/templates/editChoicesAdmin.html
@@ -3,9 +3,9 @@
{% load i18n %}
{% block fullscript %}
-<script type="text/javascript" src="http://{{root_url}}admin/jsi18n/"></script>
-<script type="text/javascript" src="http://{{root_url}}media/js/core.js"></script>
-<script type="text/javascript" src="http://{{root_url}}media/js/admin/RelatedObjectLookups.js"></script>
+<script type="text/javascript" src="{{root_url}}admin/jsi18n/"></script>
+<script type="text/javascript" src="{{root_url}}media/js/core.js"></script>
+<script type="text/javascript" src="{{root_url}}media/js/admin/RelatedObjectLookups.js"></script>
{{ form_new_choice.media }}
{% endblock %}
@@ -14,7 +14,7 @@
{% blocktrans %}As long as no options were added to the poll, it will not be available.{% endblocktrans %}
</p>{% else %}
<h2>{% trans "Complete/Finalise the poll" %}</h2>
-<p><a href='http://{{root_url}}edit/{{poll.admin_url}}'><button>{% trans "Next"%}</button></p>
+<p><a href='{{root_url}}edit/{{poll.admin_url}}'><button>{% trans "Next"%}</button></p>
{% endif %}
{% include 'editChoices.html' %}
{% if choices %}
diff --git a/templates/editChoicesUser.html b/templates/editChoicesUser.html
index 4313ade..0d2b2c1 100644
--- a/templates/editChoicesUser.html
+++ b/templates/editChoicesUser.html
@@ -3,14 +3,14 @@
{% load i18n %}
{% block fullscript %}
-<script type="text/javascript" src="http://{{root_url}}admin/jsi18n/"></script>
-<script type="text/javascript" src="http://{{root_url}}media/js/core.js"></script>
-<script type="text/javascript" src="http://{{root_url}}media/js/admin/RelatedObjectLookups.js"></script>
+<script type="text/javascript" src="{{root_url}}admin/jsi18n/"></script>
+<script type="text/javascript" src="{{root_url}}media/js/core.js"></script>
+<script type="text/javascript" src="{{root_url}}media/js/admin/RelatedObjectLookups.js"></script>
{{ form_new_choice.media }}
{% endblock %}
{% block content %}
- <p><a href="http://{{root_url}}poll/{{poll.base_url}}/">{%trans "Return to the poll"%}</a></p>
+ <p><a href="{{root_url}}poll/{{poll.base_url}}/">{%trans "Return to the poll"%}</a></p>
<h2>{% trans "Choices" %}</h2>
{% if choices %}<table class='new_poll'>
<tr>
diff --git a/templates/vote.html b/templates/vote.html
index 31ba7b0..eb1ae21 100644
--- a/templates/vote.html
+++ b/templates/vote.html
@@ -3,9 +3,9 @@
{% load get_range %}
{% block fullscript %}
-<script type="text/javascript" src="http://{{root_url}}admin/jsi18n/"></script>
-<script type="text/javascript" src="http://{{root_url}}media/js/core.js"></script>
-<script type="text/javascript" src="http://{{root_url}}media/js/admin/RelatedObjectLookups.js"></script>
+<script type="text/javascript" src="{{root_url}}admin/jsi18n/"></script>
+<script type="text/javascript" src="{{root_url}}media/js/core.js"></script>
+<script type="text/javascript" src="{{root_url}}media/js/admin/RelatedObjectLookups.js"></script>
{{ form_comment.media }}
{% endblock %}
@@ -119,10 +119,10 @@
<hr class='spacer'/>
</form>
{%if poll.opened_admin%}
- <p><a href="http://{{root_url}}editChoicesUser/{{poll.base_url}}/">{%trans "Add a new choice to this poll?"%}</a></p>{%endif%}
+ <p><a href="{{root_url}}editChoicesUser/{{poll.base_url}}/">{%trans "Add a new choice to this poll?"%}</a></p>{%endif%}
<div class='footnote'>
{%if hide_vote%}<p>{% trans "You have already vote? You are enough wise not to be influenced by other votes? You can display result by clicking" %} <a href='?display_result=1'>{% trans "here" %}</a>.</p>{%else%}
- <p>{% trans "Remain informed of poll evolution:" %} <a href="http://{{root_url}}feeds/poll/{{poll.base_url}}/">{%trans "syndication"%}</a></p>{%endif%}
+ <p>{% trans "Remain informed of poll evolution:" %} <a href="{{root_url}}feeds/poll/{{poll.base_url}}/">{%trans "syndication"%}</a></p>{%endif%}
</div>
{%if not hide_vote%}
<h3>{%trans "Comments"%}</h3>