Merge pull request #2964 from bookwyrm-social/delete-announcement-view

Makes the delete announcement view post-only
This commit is contained in:
Mouse Reeve 2023-09-05 16:43:31 -07:00 committed by GitHub
commit a09b2ab45c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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