Praktikum 8 v2

This commit is contained in:
Heimbs 2019-12-03 13:52:55 +01:00
parent 85f2a7ca03
commit 9b3eb7090a

View File

@ -1,8 +1,10 @@
import logging
from django.shortcuts import render, redirect, render_to_response
from django.http import HttpResponse, JsonResponse
from django.utils import timezone
from django.contrib import messages
from django.views.decorators.csrf import csrf_exempt
from rest_framework.renderers import JSONRenderer
from rest_framework.parsers import JSONParser
@ -59,6 +61,7 @@ def delete(request, deleteId=None):
return redirect('posts')
@csrf_exempt
def notice_list(request):
if request.method == 'GET':
notices = Notice.objects.all()
@ -74,6 +77,7 @@ def notice_list(request):
return JsonResponse(serializer.errors, status=400)
@csrf_exempt
def notice_detail(request, id):
try:
notice = Notice.objects.get(id=id)