File diff 2006604b154e → 07faf5cebca9
Show inline comments
from import Entry, EntryTag # relative import
# from django.views.generic.list_detail import object_list
from django.views.generic import ListView
from django.views.generic.dates import YearArchiveView, MonthArchiveView, DayArchiveView, DateDetailView
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from conservancy.apps.staff.models import Person
from django.shortcuts import get_object_or_404, render_to_response
from django.template import RequestContext
from django.shortcuts import get_object_or_404, render
from datetime import datetime

def OR_filter(field_name, objs):
    from django.db.models import Q
    return reduce(lambda x, y: x | y,
                  [Q(**{field_name:}) for x in objs])
@@ -62,13 +61,13 @@ def custom_index(request, queryset, *args, **kwargs):
    except EmptyPage:
        # If page is out of range (e.g. 9999), deliver last page of results.
        blog_entries =

    extra_context['blog_entries'] = blog_entries

    return render_to_response('blog/entry_list.html', extra_context, context_instance=RequestContext(request))
    return render(request, 'blog/entry_list.html', extra_context)

def techblog_redirect(request):
    """Redirect from the old 'techblog' to the new blog

    path = request.path[len('/technology'):]
@@ -100,14 +99,13 @@ def query(request):

        authors = sorted(Person.objects.filter(currently_employed=True,
        tags = EntryTag.objects.all().order_by('label')
        return render_to_response('blog/query.html',
                                  {'authors': authors, 'tags': tags}, context_instance=RequestContext(request))
        return render(request, 'blog/query.html', {'authors': authors, 'tags': tags})

def relative_redirect(request, path):
    from django import http
    from django.conf import settings

    host = request.get_host()