@@ -14,25 +14,25 @@
# 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/>.
import datetime
from django.conf import settings
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.syndication.views import Feed
from django.conf.urls import url
from django.views.generic.dates import (
DateDetailView,
DayArchiveView,
MonthArchiveView,
YearArchiveView,
)
from . import frontpage
from .feeds import Mp3CastFeed, OggCastFeed, feed_dict, view
from .feeds import Mp3CastFeed, OggCastFeed, view
from .models import Cast, CastTag
from .views import custom_index, query
app_name = 'podjango'
extra_context = {}
@@ -57,12 +57,13 @@ urlpatterns = [
]
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.
"""
@@ -82,12 +83,13 @@ def all_tags_by_use_amount():
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