#!/usr/bin/env python
#! -*- encoding:utf-8 -*-

import datetime
import qiniu

from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.decorators import authentication_classes
from rest_framework.decorators import permission_classes 

from restaurant.models import Restaurant

from restaurant.serializers import RestaurantSerializer


@api_view(["GET"])
@authentication_classes(())
@permission_classes(())
def get_restaurant(request):
    """
    通过openid获取餐厅信息
    """

    openid = request.GET.get('openid', None)
    try:
        restaurant = Restaurant.objects.get(openid=openid)
    except Restaurant.DoesNotExist:
        return Response('restaurant not found', status=status.HTTP_404_NOT_FOUND)
    serializer = RestaurantSerializer(restaurant)
    return Response(serializer.data)

e0878fc5bd1fa2dc74736bf1faf72d2f5652c81f
<mask token>

<mask token>


@api_view(['GET'])
@authentication_classes(())
@permission_classes(())
def get_restaurant(request):
    """
    通过openid获取餐厅信息
    """
    openid = request.GET.get('openid', None)
    try:
        restaurant = Restaurant.objects.get(openid=openid)
    except Restaurant.DoesNotExist:
        return Response('restaurant not found', status=status.
            HTTP_404_NOT_FOUND)
    serializer = RestaurantSerializer(restaurant)
    return Response(serializer.data)

import datetime
import qiniu
from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.decorators import authentication_classes
from rest_framework.decorators import permission_classes
from restaurant.models import Restaurant
from restaurant.serializers import RestaurantSerializer


@api_view(['GET'])
@authentication_classes(())
@permission_classes(())
def get_restaurant(request):
    """
    通过openid获取餐厅信息
    """
    openid = request.GET.get('openid', None)
    try:
        restaurant = Restaurant.objects.get(openid=openid)
    except Restaurant.DoesNotExist:
        return Response('restaurant not found', status=status.
            HTTP_404_NOT_FOUND)
    serializer = RestaurantSerializer(restaurant)
    return Response(serializer.data)

#!/usr/bin/env python
#! -*- encoding:utf-8 -*-

import datetime
import qiniu

from rest_framework import status
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework.decorators import authentication_classes
from rest_framework.decorators import permission_classes 

from restaurant.models import Restaurant

from restaurant.serializers import RestaurantSerializer


@api_view(["GET"])
@authentication_classes(())
@permission_classes(())
def get_restaurant(request):
    """
    通过openid获取餐厅信息
    """

    openid = request.GET.get('openid', None)
    try:
        restaurant = Restaurant.objects.get(openid=openid)
    except Restaurant.DoesNotExist:
        return Response('restaurant not found', status=status.HTTP_404_NOT_FOUND)
    serializer = RestaurantSerializer(restaurant)
    return Response(serializer.data)
