|
|
|
|
|
|
|
|
import logging |
|
|
import logging |
|
|
|
|
|
|
|
|
from django.shortcuts import render, redirect, render_to_response |
|
|
from django.shortcuts import render, redirect, render_to_response |
|
|
from django.http import HttpResponse, JsonResponse |
|
|
from django.http import HttpResponse, JsonResponse |
|
|
from django.utils import timezone |
|
|
from django.utils import timezone |
|
|
from django.contrib import messages |
|
|
from django.contrib import messages |
|
|
|
|
|
from django.views.decorators.csrf import csrf_exempt |
|
|
|
|
|
|
|
|
from rest_framework.renderers import JSONRenderer |
|
|
from rest_framework.renderers import JSONRenderer |
|
|
from rest_framework.parsers import JSONParser |
|
|
from rest_framework.parsers import JSONParser |
|
|
|
|
|
|
|
|
return redirect('posts') |
|
|
return redirect('posts') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@csrf_exempt |
|
|
def notice_list(request): |
|
|
def notice_list(request): |
|
|
if request.method == 'GET': |
|
|
if request.method == 'GET': |
|
|
notices = Notice.objects.all() |
|
|
notices = Notice.objects.all() |
|
|
|
|
|
|
|
|
return JsonResponse(serializer.errors, status=400) |
|
|
return JsonResponse(serializer.errors, status=400) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@csrf_exempt |
|
|
def notice_detail(request, id): |
|
|
def notice_detail(request, id): |
|
|
try: |
|
|
try: |
|
|
notice = Notice.objects.get(id=id) |
|
|
notice = Notice.objects.get(id=id) |