Changeset - 70d6eb7140c7
[Not reviewed]
0 6 0
Ben Sturmfels (bsturmfels) - 11 months ago 2023-10-19 06:49:57
ben@sturm.com.au
podjango: Link up "The Corresponding Source" title

This helps with navigating back to the home page.
6 files changed with 6 insertions and 8 deletions:
0 comments (0 inline, 0 general)
www/podjango/templates/podjango/cast/cast_archive_day.html
Show inline comments
 
<!-- FIXME: SFLC specific content -->
 
<!--  Copyright (C) 2008       Bradley M. Kuhn <bkuhn@ebb.org> -->
 
<!-- Permission is granted to copy, modify, redistribute, propagate,  -->
 
<!-- and/or convey this template in any form. -->
 
{% extends "podjango/base_podcast.html" %}
 

	
 
{% block subtitle %}Archive: {{ day|date:"F j, Y" }} - {% endblock %}
 

	
 
{% block content %}
 

	
 

	
 
<h1>{% include 'podjango/feed_links.inc.html' %} The Corresponding Source</h1>
 
<h1>{% include 'podjango/feed_links.inc.html' %} <a href="{% url 'podjango:cast-home' %}">The Corresponding Source</h1>
 

	
 
<h2>Archive: {{ day|date:"F j, Y" }}</h2>
 

	
 
{% for object in object_list %}
 
    <div class="pa2 mb2" style="background: #F0FFB8">
 
    <h3><a href="{{ object.get_absolute_url }}">{{ object.title|safe }}</a></h3>
 
    <p class="date">{{ object.pub_date|date:"F j, Y" }}</p>
 
        {{ object.summary|safe }}
 
    <p><span class="continued"><a href="{{ object.get_absolute_url
 
    }}">Read More...</a></span></p>
 
    <p>Released on {{ object.pub_date|date:"F j, Y" }}; its running time is {{ object.duration }}</p>
 
    {% if object.tags.all %}<p class="blog-tags small">Tags: {% for tag in object.tags.all %}<a href="{{ tag.get_absolute_url }}">{{ tag.label }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</p>{% endif %}
 
    </div>
 
{% endfor %}
 

	
 
{% endblock %}
www/podjango/templates/podjango/cast/cast_archive_month.html
Show inline comments
 
<!-- FIXME: SFLC specific content -->
 
<!--  Copyright (C) 2008       Bradley M. Kuhn <bkuhn@ebb.org> -->
 
<!-- Permission is granted to copy, modify, redistribute, propagate, -->
 
<!-- and/or convey this template in any form. -->
 
{% extends "podjango/base_podcast.html" %}
 

	
 
{% block subtitle %}Archive: {{ month|date:"F, Y" }} - {% endblock %}
 

	
 
{% block content %}
 

	
 

	
 
<h1>{% include 'podjango/feed_links.inc.html' %}The Corresponding Source</h1>
 
<h1>{% include 'podjango/feed_links.inc.html' %} <a href="{% url 'podjango:cast-home' %}">The Corresponding Source</h1>
 

	
 
<h2>Archive: {{ month|date:"F, Y" }}</h2>
 

	
 
{% for object in object_list %}
 
    <div class="pa2 mb2" style="background: #F0FFB8">
 
    <h3><a href="{{ object.get_absolute_url }}">{{ object.title|safe }}</a></h3>
 
    <p class="date">{{ object.pub_date|date:"F j, Y" }}</p>
 
        {{ object.summary|safe }}
 
    <p><span class="continued"><a href="{{ object.get_absolute_url
 
    }}">Read More...</a></span></p>
 
    <p>Released on {{ object.pub_date|date:"F j, Y" }}; its running time is {{ object.duration }}</p>
 
    {% if object.tags.all %}<p class="blog-tags small">Tags: {% for tag in object.tags.all %}<a href="{{ tag.get_absolute_url }}">{{ tag.label }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</p>{% endif %}
 
    </div>
 
{% endfor %}
 

	
 
{% endblock %}
www/podjango/templates/podjango/cast/cast_archive_year.html
Show inline comments
 
<!-- FIXME: SFLC specific content -->
 
<!--  Copyright (C) 2008       Bradley M. Kuhn <bkuhn@ebb.org> -->
 
<!-- Permission is granted to copy, modify, redistribute, propagate, -->
 
<!-- and/or convey this template in any form. -->
 
{% extends "podjango/base_podcast.html" %}
 

	
 
{% block subtitle %}Archive: {{ year }} - {% endblock %}
 

	
 
{% block content %}
 

	
 
<h1>{% include 'podjango/feed_links.inc.html' %} The Corresponding Source</h1>
 
<h1>{% include 'podjango/feed_links.inc.html' %} <a href="{% url 'podjango:cast-home' %}">The Corresponding Source</h1>
 

	
 
<h2>Archive: {{ year }}</h2>
 

	
 
<ul>
 
{% for object in object_list %}
 
    <li><a href="{{ object.get_absolute_url }}"><b>{{ object.title|safe }}</b></a><br/>
 
    <i>{{ object.pub_date|date:"F j, Y" }}; duration: {{ object.duration }}</i></li>
 
{% endfor %}
 
</ul>
 

	
 
{% endblock %}
www/podjango/templates/podjango/cast/cast_detail.html
Show inline comments
 
<!-- FIXME: SFLC specific content -->
 
<!--  Copyright (C) 2008       Bradley M. Kuhn <bkuhn@ebb.org> -->
 
<!-- Permission is granted to copy, modify, redistribute, propagate, -->
 
<!-- and/or convey this template in any form. -->
 
{% extends "podjango/base_podcast.html" %}
 

	
 
{% block subtitle %}{{ object.title|striptags }} - The Corresponding Source  - {% endblock %}
 

	
 
{% block content %}
 

	
 
<h1>{% include 'podjango/feed_links.inc.html' %} The Corresponding Source</h1>
 
<h1>{% include 'podjango/feed_links.inc.html' %} <a href="{% url 'podjango:cast-home' %}">The Corresponding Source</h1>
 

	
 
<h2><a class="feedlink" href="{{ object.ogg_path }}">{% include 'podjango/audio_ogg_button.inc.html' %}</a>
 
<a class="feedlink" href="{{ object.mp3_path }}">{% include 'podjango/audio_mp3_button.inc.html' %}</a>
 
{{ object.title|safe }}</h2>
 

	
 
<p class="date">{{ object.pub_date|date:"j F Y" }}</p>
 

	
 
<h3>Download</h3>
 

	
 
<p>
 
<a href="{{ object.ogg_path }}" class="document_format">ogg</a><a href="{{ object.mp3_path }}"  class="document_format">mp3</a>
 
</p>
 

	
 
<h3>Summary</h3>
 

	
 
{{ object.summary|safe }}
 

	
 
<p>
 
This show was released on {{ object.pub_date|date:"l j F Y" }}; its
 
running time is {{ object.duration}}.</p>
 

	
 
<h3>Show Notes</h3>
 
<div>
 
  {{ object.body|safe }}
 
</div>
 

	
 
<h3>Feedback</h3>
 
<p>Send feedback and comments on the oggcast
 
to <a href="mailto:oggcast@faif.us">&lt;oggcast@faif.us&gt;</a>.
 
You can keep in touch on our IRC channel, #faif on irc.freenode.net, and
 
by <a href="http://identi.ca/faif">following @faif on identi.ca</a>.</p>
 

	
 
{% if object.tags.all %}<p class="blog-tags">Tags: {% for tag in object.tags.all %}<a href="{{ tag.get_absolute_url }}">{{ tag.label }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</p>{% endif %}
 

	
 
<p><span class="continued"><a href="{% url 'podjango:cast' %}">Other FaiF oggcasts&hellip;</a></span></p>
 

	
 
{% endblock %}
www/podjango/templates/podjango/cast/cast_list.html
Show inline comments
 
<!-- FIXME: SFLC specific content -->
 
<!--  Copyright (C) 2008       Bradley M. Kuhn <bkuhn@ebb.org> -->
 
<!-- Permission is granted to copy, modify, redistribute, propagate,  -->
 
<!-- and/or convey this template in any form. -->
 
{% extends "podjango/base_podcast.html" %}
 

	
 
{% block subtitle %}The Corresponding Source - {% endblock %}
 

	
 
{% block content %}
 

	
 
<h1>{% include 'podjango/feed_links.inc.html' %} The Corresponding Source</h1>
 
<h1>{% include 'podjango/feed_links.inc.html' %} <a href="{% url 'podjango:cast-home' %}">The Corresponding Source</h1>
 

	
 
{% if tags %}
 
<p>Displaying casts
 
tagged {% for tag in tags %}{% if not forloop.last %}{% if not forloop.first %}, {% endif %}{% endif %}<a href="{{ tag.get_absolute_url }}">{{ tag.label }}</a>{% ifequal forloop.revcounter 2 %} or {% endifequal %}{% endfor %}
 
</p>
 
{% endif %}
 

	
 
{% for object in object_list %}
 
    <div class="pa2 mb2" style="background: #F0FFB8">
 
    <h3>
 
<a class="feedlink" href="{{ object.ogg_path }}">{% include 'podjango/audio_ogg_button.inc.html' %}</a>
 
<a class="feedlink" href="{{ object.mp3_path }}">{% include 'podjango/audio_mp3_button.inc.html' %}</a>
 

	
 
<a href="{{ object.get_absolute_url }}">{{ object.title|safe }}</a></h3>
 
    <p class="date">{{ object.pub_date|date:"F j, Y" }}</p>
 
    <h4>Summary</h4>
 

	
 
    {{ object.summary|safe }}
 

	
 
    <p>
 
    This show was released on {{ object.pub_date|date:"l j F Y" }}; its
 
    running time is {{ object.duration}}.</p>
 
    <h4>Show Notes</h4>
 
    <div>
 
      {{ object.body|safe }}
 
    </div>
 

	
 
    {% if object.tags.all %}<p class="cast-tags small">Tags: {% for tag in object.tags.all %}<a href="{{ tag.get_absolute_url }}">{{ tag.label }}</a>{% if not forloop.last %}, {% endif %}{% endfor %}</p>{% endif %}
 
    </div>
 
{% endfor %}
 

	
 
<p>
 
{% if has_next %}<a class="next_page_button" href="?page={{ next }}{% if query_string %}&amp;{{ query_string|escape }}{% endif %}">Next page (older) &raquo;</a>{% endif %}
 
{% if has_previous %}<a href="?page={{ previous }}{% if query_string %}&amp;{{ query_string|escape }}{% endif %}">&laquo; Previous page (newer)</a>{% endif %}
 
</p>
 
<div class="clear"></div>
 

	
 
{% if date_list %}
 
<h3>Index by date</h3>
 
<ul>
 
{% for year in date_list %}<li><a href="{{ year|date:"Y" }}/">{{ year|date:"Y" }}</a></li>{% endfor %}
 
</ul>
 
{% endif %}
 

	
 
{% endblock %}
www/podjango/urls.py
Show inline comments
 
# Copyright 2010       Bradley M. Kuhn <bkuhn@ebb.org>
 
# Copyright 2005-2008  James Garrison
 

	
 
# This software's license gives you freedom; you can copy, convey,
 
# propagate, redistribute, modify and/or redistribute modified versions of
 
# this program under the terms of the GNU Affero General Public License
 
# (AGPL) as published by the Free Software Foundation (FSF), either
 
# version 3 of the License, or (at your option) any later version of the
 
# AGPL published by the FSF.
 
#
 
# This program is distributed in the hope that it will be useful, but
 
# WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero
 
# General Public License for more details.
 
#
 
# You should have received a copy of the GNU Affero General Public License
 
# along with this program in a file in the toplevel directory called
 
# "AGPLv3".  If not, see <http://www.gnu.org/licenses/>.
 

	
 
from django.conf import settings
 
from django.conf.urls import url, include
 
from django.contrib import admin
 
from django.contrib.syndication.views import Feed
 
from django.views.generic.dates import DateDetailView, DayArchiveView, MonthArchiveView, YearArchiveView
 

	
 
from . import frontpage
 
from .feeds import feed_dict, view, Mp3CastFeed, OggCastFeed
 
from .models import Cast, CastTag
 
from .views import custom_index, query
 

	
 
app_name = 'podjango'
 

	
 
extra_context = {}
 
info_dict = {
 
    'queryset': Cast.objects.all(),
 
    'date_field': 'pub_date',
 
    'extra_context': extra_context,
 
    'template_name': 'podjango/cast/cast_detail.html',
 
}
 

	
 
urlpatterns = [
 
    url(r'^$', frontpage.view),
 
    url(r'^$', frontpage.view, name='cast-home'),
 
    url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?P<slug>[-\w]+)/$', DateDetailView.as_view(**info_dict), name='detail'),
 
    url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/$', DayArchiveView.as_view(**info_dict), name='day-archive'),
 
    url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$', MonthArchiveView.as_view(**info_dict), name='month-archive'),
 
    url(r'^(?P<year>\d{4})/$', YearArchiveView.as_view(**info_dict), name='year-archive'),
 
    url(r'^all/$', custom_index, dict(info_dict, paginate_by=20), name='cast'),
 
    url(r'^query/$', query, name='query'),
 
    url(r'^feeds/cast-ogg/$', OggCastFeed(), name='feed-ogg'),
 
    url(r'^feeds/cast-mp3/$', Mp3CastFeed(), name='feed-mp3'),
 
    url(r'^feeds/$', view, name='feeds'),
 
]
 

	
 
if settings.DEBUG:
 
  from django.conf.urls.static import static
 
  urlpatterns += static('/', document_root='podjango/static')
 

	
 
def all_tags_by_use_amount():
 
    """Returns all tags with an added 'cnt' attribute (how many times used)
 

	
 
    Also sorts the tags so most-used tags appear first.
 
    """
 

	
 
    # tally use amount
 
    retval = []
 
    current = None
 
    for obj in CastTag.objects.filter(cast__pub_date__lte=datetime.now(),
 
                                      cast__isnull=False).order_by('label'):
 
        if current is not None and obj.id == current.id:
 
            current.cnt += 1
 
        else:
 
            if current is not None:
 
                retval.append(current)
 
            current = obj
 
            current.cnt = 1
 
    if current is not None:
 
        retval.append(current)
 

	
 
    # sort and return
 
    retval.sort(key=lambda x: -x.cnt)
 
    return retval
 

	
 
# The functions are passed to the context uncalled so they will be
 
# called for each web request.  If we want to only make these database
 
# queries a single time when a web server process begins, call both
 
# functions below (i.e. make both lines below end in '()')
 

	
 
extra_context['all_tags'] = all_tags_by_use_amount
0 comments (0 inline, 0 general)