<commit_before>import warnings
import re

from django.contrib.gis.geos import Point
from django.contrib.gis.measure import D
from django.http import Http404
from django.db.models import Count
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.views.generic import RedirectView, TemplateView
from django.shortcuts import get_object_or_404
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.db.models import Q

import mapit
from haystack.views import SearchView
from haystack.query import SearchQuerySet
from haystack.inputs import AutoQuery
from haystack.forms import SearchForm

from popit.models import Person as PopitPerson
from speeches.models import Section, Speech, Speaker, Tag
from speeches.views import NamespaceMixin, SpeechView, SectionView

from pombola.core import models
from pombola.core.views import (HomeView, PlaceDetailView, PlaceDetailSub,
    OrganisationDetailView, PersonDetail, PlaceDetailView,
    OrganisationDetailSub)
from pombola.info.models import InfoPage, Category
from pombola.info.views import InfoPageView

from pombola.south_africa.models import ZAPlace

# In the short term, until we have a list of constituency offices and
# addresses from DA, let's bundle these together.
CONSTITUENCY_OFFICE_PLACE_KIND_SLUGS = (
    'constituency-office',
    'constituency-area', # specific to DA party
)

class SAHomeView(HomeView):

    def get_context_data(self, **kwargs):
        context = super(SAHomeView, self).get_context_data(**kwargs)
        articles = InfoPage.objects.filter(
            kind=InfoPage.KIND_BLOG).order_by("-publication_date")

        context['news_categories'] = []
        for slug in ('week-parliament', 'impressions'):
            try:
                c = Category.objects.get(slug=slug)
                context['news_categories'].append(
                    (c, articles.filter(categories=c)[:4]))
            except Category.DoesNotExist:
                pass<commit_msg>ZA: on the home page, swap "That Week ..." for "Elections 2014"<commit_after>import warnings
import re

from django.contrib.gis.geos import Point
from django.contrib.gis.measure import D
from django.http import Http404
from django.db.models import Count
from django.conf import settings
from django.core.exceptions import ObjectDoesNotExist
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from django.views.generic import RedirectView, TemplateView
from django.shortcuts import get_object_or_404
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.db.models import Q

import mapit
from haystack.views import SearchView
from haystack.query import SearchQuerySet
from haystack.inputs import AutoQuery
from haystack.forms import SearchForm

from popit.models import Person as PopitPerson
from speeches.models import Section, Speech, Speaker, Tag
from speeches.views import NamespaceMixin, SpeechView, SectionView

from pombola.core import models
from pombola.core.views import (HomeView, PlaceDetailView, PlaceDetailSub,
    OrganisationDetailView, PersonDetail, PlaceDetailView,
    OrganisationDetailSub)
from pombola.info.models import InfoPage, Category
from pombola.info.views import InfoPageView

from pombola.south_africa.models import ZAPlace

# In the short term, until we have a list of constituency offices and
# addresses from DA, let's bundle these together.
CONSTITUENCY_OFFICE_PLACE_KIND_SLUGS = (
    'constituency-office',
    'constituency-area', # specific to DA party
)

class SAHomeView(HomeView):

    def get_context_data(self, **kwargs):
        context = super(SAHomeView, self).get_context_data(**kwargs)
        articles = InfoPage.objects.filter(
            kind=InfoPage.KIND_BLOG).order_by("-publication_date")

        context['news_categories'] = []
        for slug in ('elections-2014', 'impressions'):
            try:
                c = Category.objects.get(slug=slug)
                context['news_categories'].append(
                    (c, articles.filter(categories=c)[:4]))
            except Category.DoesNotExist:
                pass
{'fraction_non_alphanumeric': 0.0711768851303735, 'fraction_numerical': 0.00516795865633075, 'mean_word_length': 4.173754556500607, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6513762', 'n_tokens_mistral': 1219, 'n_tokens_neox': 1169, 'n_words': 359}