diff --git a/bookwyrm/forms.py b/bookwyrm/forms.py index 1477234f..855edf1e 100644 --- a/bookwyrm/forms.py +++ b/bookwyrm/forms.py @@ -121,6 +121,20 @@ class StatusForm(CustomForm): fields = ["user", "content", "content_warning", "sensitive", "privacy"] +def get_form_from_status(status): + """ form-ify a status (for delete and redraft) """ + if isinstance(status, models.Review): + return ReviewForm(instance=status) + if isinstance(status, models.Comment): + return CommentForm(instance=status) + if isinstance(status, models.Quotation): + return QuotationForm(instance=status) + if status.reply_parent: + return ReplyForm(instance=status) + else: + return StatusForm(instance=status) + + class EditUserForm(CustomForm): class Meta: model = models.User diff --git a/bookwyrm/templates/snippets/status/status_options.html b/bookwyrm/templates/snippets/status/status_options.html index 6f0ca2e6..7cc74f07 100644 --- a/bookwyrm/templates/snippets/status/status_options.html +++ b/bookwyrm/templates/snippets/status/status_options.html @@ -19,6 +19,14 @@ +
  • + +
  • {% else %} {# things you can do to other people's statuses #}
  • diff --git a/bookwyrm/views/status.py b/bookwyrm/views/status.py index 10b9ebf8..1b4f8977 100644 --- a/bookwyrm/views/status.py +++ b/bookwyrm/views/status.py @@ -107,8 +107,8 @@ class DeleteAndRedraft(View): if status.user != request.user and not request.user.has_perm("moderate_post"): return HttpResponseBadRequest() - # TODO: get the correct form (maybe a generic form) - data = {"form": forms.StatusForm(instance=status)} + + data = {"form": forms.get_form_from_status(status)} if hasattr(status, "book"): data["book"] = status.book