Beispiel #1
0
def sites_for_state(request):
    """ Display a list of FederalSites per state. """

    state = request.GET.get('state')
    sites = FederalSiteResource().list(state)
    states_lookup = States()
    return render(request, 'redemption-list-state.html', {
        'sites': sites,
        'state_name': states_lookup.states[state]
    })
Beispiel #2
0
def pass_exchange(request):
    """Display the list of sites one can exchange a voucher for a pass at."""

    state = request.GET.get('state', None)

    if state:
        sites = FederalSiteResource().list(state)
        form = PassSiteStateForm(initial={'state': state})
        state_name = STATES[state]
    else:
        form = PassSiteStateForm()
        sites = []
        state_name = None

    return render(request, 'plan-your-trip/pass_exchange.html', {
        'sites': sites,
        'form': form,
        'state_name': state_name
    })
Beispiel #3
0
def get_active_pass_exchange_sites(state):
    """ For a given state, return the sites that are issuing kids passes. """
    return FederalSiteResource().list(state, 1)
Beispiel #4
0
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.contrib.auth import views as auth_views

from nationalparks.api import FederalSiteResource, FieldTripResource
from ticketer.recordlocator.views import TicketResource

urlpatterns = patterns(
    '',
    url(r'', include('everykid.urls')),
    url(r'^admin/', include(admin.site.urls)),
    url('api/tickets/', include(TicketResource.urls())),
    url(r'api/passes/', include(FederalSiteResource.urls())),
    url(r'api/fieldtrips/', include(FieldTripResource.urls())),
    url(r'^accounts/login/$', auth_views.login),
    url(r'^accounts/logout/$', auth_views.logout),
    url(r'^redeem/', include('redemption.urls')),
    url(r'^game/', include('game.urls')),
)