diff --git a/ofu_app/api/views/food_views.py b/ofu_app/api/views/food_views.py index d12be65..b580ebd 100644 --- a/ofu_app/api/views/food_views.py +++ b/ofu_app/api/views/food_views.py @@ -3,12 +3,17 @@ from __future__ import unicode_literals from datetime import datetime from datetime import timedelta + from api.serializers.food_serializers import MenuSerializer, HappyHourSerializer from apps.food.models import Menu, HappyHour from rest_framework import viewsets -from django.http import JsonResponse + +from rest_framework.decorators import api_view, permission_classes +from rest_framework.permissions import AllowAny +# @api_view(['GET']) +@permission_classes((AllowAny,)) class FoodViewSet(viewsets.ModelViewSet): """ API endpoint that allows users to be viewed or edited. @@ -44,12 +49,14 @@ class FoodViewSet(viewsets.ModelViewSet): else: queryset = queryset.filter(date=datetime.strptime(date, "%Y-%m-%d")) - print("DATE: " + date) + print("DATE: " + str(date)) print(str(queryset)) return queryset +# @api_view(['GET']) +@permission_classes((AllowAny,)) class HappyHourViewSet(viewsets.ModelViewSet): """ API endpoint that allows users to be viewed or edited. diff --git a/ofu_app/core/settings.py b/ofu_app/core/settings.py index 7786e9c..f63f845 100644 --- a/ofu_app/core/settings.py +++ b/ofu_app/core/settings.py @@ -49,7 +49,7 @@ SITE_ID = 1 REST_FRAMEWORK = { 'DEFAULT_PERMISSION_CLASSES': [ - 'rest_framework.permissions.IsAdminUser', + 'rest_framework.permissions.IsAuthenticated', ], 'PAGE_SIZE': 10 }