Exemplo n.º 1
0
def viewEnergyChart(request, page):
    chartType = 'energy'
    chartColor = '#F18C39'
    weather = True

    centralCities, innerCities, outerCities = getCities(request)

    chartData = []

    yearRange = []

    energyObjects = Energy.objects.all().order_by('year')
    year = ''
    for object in energyObjects:

        if year != object.year:
            yearRange.append(object.year)
            year = object.year

        else:
            pass

    if year != '':
        start_year = year

    else:
        start_year = None

    context = {'page': page, 'chartType': chartType, 'chartColor': chartColor, 'chartData': chartData,
               'centralCities': centralCities, 'innerCities': innerCities, 'outerCities': outerCities,
               'yearRange': yearRange, 'weather': weather, 'start_year': start_year}
    setDetailContext(context)

    return render_to_response('charts/energy.html', context)
Exemplo n.º 2
0
def viewTravelChart(request, page):
    chartType = 'travel'
    chartColor = '#96C94D'

    centralCities, innerCities, outerCities = getCities(request)

    chartData = []

    yearRange = []

    travelObjects = Travel.objects.all().order_by('year')
    year = ''
    for object in travelObjects:

        if year != object.year:
            yearRange.append(object.year)
            year = object.year

        else:
            pass

    if year != '':
        start_year = year

    else:
        start_year = None

    context = {'page': page, 'chartType': chartType, 'chartColor': chartColor, 'chartData': chartData,
               'centralCities': centralCities, 'innerCities': innerCities, 'outerCities': outerCities,
               'yearRange': yearRange, 'start_year': start_year}
    setDetailContext(context)

    return render_to_response('charts/travel.html', context)
Exemplo n.º 3
0
def viewCostChart(request, page):
    chartType = 'cost'
    chartColor = '#59614B'
    perYear = True

    centralCities, innerCities, outerCities = getCities(request)

    chartData = []

    yearRange = []

    costObjects = Cost.objects.all().order_by('year')
    year = ''
    for object in costObjects:

        if year != object.year:
            yearRange.append(object.year)
            year = object.year

        else:
            pass

    if year != '':
        start_year = year

    else:
        start_year = None

    context = {'page': page, 'chartType': chartType, 'chartColor': chartColor, 'perYear': perYear,
               'chartData': chartData,
               'centralCities': centralCities, 'innerCities': innerCities, 'outerCities': outerCities,
               'yearRange': yearRange, 'start_year': start_year}
    setDetailContext(context)

    return render_to_response('charts/cost.html', context)
Exemplo n.º 4
0
def viewParticipationForm(request):
    context = {}
    setDetailContext(context)

    return render_to_response('forms/participation_form.html', context)
Exemplo n.º 5
0
from site_content.models import WebPage, InPageLink, HomePage_Section
from utility import setDetailContext


def viewHome(request):
    try:
        page = WebPage.objects.get(is_active=True, slug='home')
        current_section = HomePage_Section.objects.get(sect_type='HOME')

    except Exception, e:
        logging.error(e)
        current_section = None
        page = None

    context = {'page': page, 'current_sect': current_section}
    setDetailContext(context)

    return render_to_response('home.html', context)


def selectHomePageSect(request):
    json_data = {}

    if request.GET['sect']:
        sect_id = request.GET['sect']
        section = HomePage_Section.objects.get(sect_type=sect_id)
        json_data['billboardUrl'] = str(section.billboard_image)
        json_data['graphUrl'] = str(section.graph_image)
        json_data['textHtml'] = str(section.graph_copy)
        json_data['sect'] = sect_id