Ejemplo n.º 1
0
def menu_display(request, slug, pk):
    menu_object = get_object_or_404(Menu, slug=slug, pk=pk)
    menu = menu_builder(pk=menu_object.pk)
    restaurant = menu_object.restaurant
    menu_url = reverse('menu_display', kwargs={'slug': slug, 'pk': pk})
    menu_complete_url = ''.join(
        ['https://', get_current_site(request).domain, menu_url])

    if restaurant.image:
        menu_image = restaurant.image.url
    else:
        menu_image = False

    context = {
        'menu_title': menu['title'],
        'menu': menu['itens'],
        'restaurant_pk': menu['restaurant_pk'],
        'menu_pk': pk,
        'online_sales': menu['online_sale'],
        'menu_object': menu_object,
        'menu_complete_url': menu_complete_url,
        'restaurant': restaurant,
        'menu_image': menu_image,
    }

    return render(request, 'menus/food-menu.html', context=context)
Ejemplo n.º 2
0
def restaurant_main(request, slug):
    restaurant = get_object_or_404(Restaurant, slug=slug)
    menu_object = restaurant.menu_set.first()
    menu = menu_builder(pk=menu_object.pk)
    menu_url = reverse('restaurant_main', kwargs={'slug': slug})
    menu_complete_url = ''.join(
        ['https://', get_current_site(request).domain, menu_url])

    if restaurant.image:
        menu_image = restaurant.image.url
    else:
        menu_image = False

    context = {
        'menu_title': menu['title'],
        'menu': menu['itens'],
        'restaurant_pk': menu['restaurant_pk'],
        'variations_style': menu['variations_style'],
        'dark_mode': menu['dark_mode'],
        'menu_pk': menu_object.pk,
        'online_sales': menu['online_sale'],
        'menu_object': menu_object,
        'menu_complete_url': menu_complete_url,
        'restaurant': restaurant,
        'menu_image': menu_image,
    }

    return render(request, 'menus/food-menu.html', context=context)
Ejemplo n.º 3
0
def menu_json(request, pk):
    menu = menu_builder(pk=pk)

    context = {
        'menu_title': menu['title'],
        'menu': menu['itens'],
        'restaurant_pk': menu['restaurant_pk'],
    }

    return JsonResponse(context)
Ejemplo n.º 4
0
def menu_print(request, pk):
    menu = menu_builder(pk=pk)

    context = {
        'menu_title': menu['title'],
        'menu': menu['itens'],
        'restaurant_pk': menu['restaurant_pk'],
    }

    return render(request, 'menus/food-menu-print.html', context=context)