Allow all api access

This commit is contained in:
michigg 2017-11-16 16:02:01 +01:00
parent dbbc99132d
commit f7c83ac40c
2 changed files with 10 additions and 3 deletions

View File

@ -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.

View File

@ -49,7 +49,7 @@ SITE_ID = 1
REST_FRAMEWORK = {
'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.IsAdminUser',
'rest_framework.permissions.IsAuthenticated',
],
'PAGE_SIZE': 10
}