Makes deleting announcements only work via POST

This commit is contained in:
Mouse Reeve 2023-09-01 16:59:56 -07:00
parent e5f8e4babc
commit b0601a0958

View file

@ -5,6 +5,7 @@ from django.shortcuts import get_object_or_404, redirect
from django.template.response import TemplateResponse
from django.utils.decorators import method_decorator
from django.views import View
from django.views.decorators.http import require_POST
from bookwyrm import forms, models
from bookwyrm.settings import PAGE_LENGTH
@ -108,6 +109,7 @@ class EditAnnouncement(View):
@login_required
@permission_required("bookwyrm.edit_instance_settings", raise_exception=True)
@require_POST
def delete_announcement(_, announcement_id):
"""delete announcement"""
announcement = get_object_or_404(models.Announcement, id=announcement_id)