def job(request, id, slug):
    prismic = PrismicHelper(request)
    context = prismic.get_context()

    return render(request, 'prismic_app/job_detail.html', {
        'context': context,
        'main': prismic.get_bookmark("jobs"),
        'job': prismic.get_document(id)
    })
def stores(request):
    prismic = PrismicHelper(request)
    context = prismic.get_context()

    all_stores = sorted(prismic.form("stores").ref(context["ref"]).submit().documents,
                          key=lambda p: p.get_text("store.name"))
    return render(request, 'prismic_app/stores.html', {
        'context': context,
        'main': prismic.get_bookmark("stores"),
        'stores': all_stores})
def store(request, id, slug):
    prismic = PrismicHelper(request)
    context = prismic.get_context()

    the_store = prismic.get_document(id)
    openings = map(lambda day: [day, the_store.get_text("store.%s[0]" % day.lower())], WEEKDAYS)
    return render(request, 'prismic_app/store_detail.html', {
        'context': context,
        'main': prismic.get_bookmark("stores"),
        'store': the_store,
        'openings': openings
        })
def jobs(request):
    prismic = PrismicHelper(request)
    context = prismic.get_context()

    jobs_doc = prismic.get_bookmark("jobs")
    services = collections.OrderedDict()
    services["Store"] = []
    services["Office"] = []
    services["Workshop"] = []
    services["Other"] = []
    for j in prismic.form("jobs").ref(context["ref"]).submit().documents:
        service = j.get_text("job-offer.service")
        if service in services:
            services[service].append(j)
        else:
            services["Other"].append(j)
    return render(request, 'prismic_app/jobs.html', {'context': context, 'jobs': jobs_doc, 'services': services})
def about(request):
    prismic = PrismicHelper()
    context = prismic.get_context()

    about_doc = prismic.get_bookmark("about")
    return render(request, 'prismic_app/about.html', {'context': context, 'about': about_doc})
def about(request):
    prismic = PrismicHelper(request)
    context = prismic.get_context()

    about_doc = prismic.get_bookmark("about")
    return render(request, 'prismic_app/about.html', {'context': context, 'about': about_doc})