http://ccbv.co.uk/projects/Django/4.0/django.views.generic.edit/DeleteView/#delete
On August 20, 2022 2:39:46 AM CDT, Hussein Ahmad <h7osanna.xyc@gmail.com> wrote:
hi.. i dont want my delete button to redirect to a success url,how can i do thatthis is my code:class ChatMessageDeleteView(LoginRequiredMixin, generic.DeleteView, UserPassesTestMixin):model = ChatMessage# success_url = ''def test_func(self):message = self.get_object()if self.request.user == message.user:return Truereturn Falsedef get_success_url(self) -> str:msg = self.get_object()chat = msg.channel.idreturn reverse('chat:chat-channel', args=[chat])my button is working but its also sending DELETE method request to the success url alsoim using htmx to send the delete request.
No comments:
Post a Comment