It looks like you can override the delete method to get rid of the redirect 
behavior:

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....@gmail.com> wrote:
>hi.. i dont want my delete button to redirect to a success url,how  can i 
>do that
>this 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 True
>        return False
>    
>     def get_success_url(self) -> str:
>         msg = self.get_object()
>         chat = msg.channel.id
>         return reverse('chat:chat-channel', args=[chat])
>
>
>*my button is working but its also sending DELETE method request to the 
>success url also*
>*im using htmx to send the delete request.*
>
>-- 
>You received this message because you are subscribed to the Google Groups 
>"Django users" group.
>To unsubscribe from this group and stop receiving emails from it, send an 
>email to django-users+unsubscr...@googlegroups.com.
>To view this discussion on the web visit 
>https://groups.google.com/d/msgid/django-users/f13638c1-f388-45a3-9eee-16b4f48ede0dn%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/266942E0-B218-4B35-9AD4-FA649BA7E3C8%40fattuba.com.

Reply via email to