G
G
German Jet2016-08-09 16:04:28
Django
German Jet, 2016-08-09 16:04:28

What is the best way to implement deleting a record using DeleteView and jQueryUI?

I did the deletion of the record without reloading the page like this:

class NewsDelete(DeleteView):
    model = News

    def get(self, request, *args, **kwargs):
        self.object = self.get_object()
        self.object.delete()
        return HttpResponse("OK")

Is there a way with less code?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Ivlev, 2016-08-12
@ivlevdenis_ru

There is. Only it is necessary to delete on POST or DELETE.

class NewsDelete(DeleteView):
    model = News

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question