Commit e7c5b954 authored by fred's avatar fred

add a link to view page online

parent b4376229
from django.template import Library
from django.conf import settings
from emissions.models import Emission, Episode, NewsItem
register = Library()
@register.filter
def online_url(object):
if isinstance(object, NewsItem):
return settings.WEBSITE_BASE_URL + 'news/' + object.slug
if isinstance(object, Emission):
return settings.WEBSITE_BASE_URL + 'emissions/' + object.slug + '/'
if isinstance(object, Episode):
return settings.WEBSITE_BASE_URL + 'emissions/' + object.emission.slug + '/' + object.slug
return 'XXX'
...@@ -132,6 +132,7 @@ INSTALLED_APPS = ( ...@@ -132,6 +132,7 @@ INSTALLED_APPS = (
'django_bootstrap_staticfiles', 'django_bootstrap_staticfiles',
'emissions', 'emissions',
'panikdb.aa', 'panikdb.aa',
'panikdb.customtags',
) )
# A sample logging configuration. The only tangible logging # A sample logging configuration. The only tangible logging
...@@ -189,6 +190,7 @@ CACHES = { ...@@ -189,6 +190,7 @@ CACHES = {
AUTH_USER_MODEL = 'aa.User' AUTH_USER_MODEL = 'aa.User'
LOGIN_REDIRECT_URL = '/' LOGIN_REDIRECT_URL = '/'
WEBSITE_BASE_URL = 'http://test-web.radiopanik.org/'
try: try:
from local_settings import * from local_settings import *
......
{% load url from future %} {% load url from future %}
{% load i18n %} {% load i18n %}
{% load panikdbtags %}
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
...@@ -42,8 +43,10 @@ ...@@ -42,8 +43,10 @@
{% block user-links %} {% block user-links %}
<a href="{% url 'home' %}" class="icon-home-space">Accueil</a> <a href="{% url 'home' %}" class="icon-home-space">Accueil</a>
<a target="blank" href="http://stats.radiopanik.org/index.php?module=Login&action=logme&login=panikdb&password=d48fb8e3a453d965901339e6b020538f" class="icon-bar-chart">Statistiques</a> <a target="blank" href="http://stats.radiopanik.org/index.php?module=Login&action=logme&login=panikdb&password=d48fb8e3a453d965901339e6b020538f" class="icon-bar-chart">Statistiques</a>
{% block online-page %} {% block online-url %}
<!--<a href="#" class="icon-eye-open">Page en ligne</a>--> {% if object %}
<a href="{{ object|online_url }}" target="blank" class="icon-eye-open">Voir en ligne</a>
{% endif %}
{% endblock %} {% endblock %}
<span class="right"> <span class="right">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment