Hi,

You can do whatever you want with any view - however listview per default
only supports get requests. If you want to do a post, then you need to add
the code for that yourself - All you need to do is add a method:

def post(self, request, *args, **kwargs)

Then you need to add the code that should delete the items there. See here
for more information:
https://stackoverflow.com/questions/15622354/django-listview-with-post-method
https://django.readthedocs.io/en/2.1.x/topics/class-based-views/mixins.html

Unfortunately not the best examples but should get you pointed in the right
direction.

Regards,

Andréas


Den tis 16 okt. 2018 kl 11:48 skrev Praveen Kumar <[email protected]>:

> Currently I have a listview and a bootstrap table that displays the number
> of records. I had tried to use request.method POST, to get the list of
> checked boxes and feed it back to the delete action. However I get an error
> stating that 'POST is not allowed 405' and when I looked on the web,
> somewhere it states that POST doesn't work with django listview.
>
> So any examples on generating a table with checkboxes which gives ability
> to delete multiple records using a delete button would be helpful!
>
> On Tue 16 Oct, 2018, 1:35 PM Joel Mathew, <[email protected]> wrote:
>
>> There's not much difference in doing this than what is standard practise.
>> You just create the regular fields, loop over the ones creating multiple
>> rows, assign unique name fields to each of them (you can use
>> {{for.counter}} for this). You then capture the request with
>> request.POST.getlist.
>>
>>
>>
>>
>> On Tue, 16 Oct 2018 at 13:27, Praveen Kumar <[email protected]> wrote:
>>
>>> Hello,
>>>
>>> Is there any django standard ways of creating a table with check boxes
>>> and let the user to select multiple rows using check box and the delete?
>>>
>>> Appreciate if anyone can help to provide an example to achieve this.
>>>
>>> Thanks,
>>>
>>> --
>>> 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 [email protected].
>>> To post to this group, send email to [email protected].
>>> Visit this group at https://groups.google.com/group/django-users.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-users/CAB0oX7_URdpMiwqxkGrQq5tJaxeP5bqSDOspUukfs7d4gO_Mow%40mail.gmail.com
>>> <https://groups.google.com/d/msgid/django-users/CAB0oX7_URdpMiwqxkGrQq5tJaxeP5bqSDOspUukfs7d4gO_Mow%40mail.gmail.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
>> 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 [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at https://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAA%3Diw__Y80aCy7FwKsoaGhgb88gr%3DvzWHnWHE4FELW%3DwBF3r%2BA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAA%3Diw__Y80aCy7FwKsoaGhgb88gr%3DvzWHnWHE4FELW%3DwBF3r%2BA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAB0oX7_QF6FxsLmKc1t2uNMN_%3DmvuutAXSGoYNkd6Q1Ft%3DdFbw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAB0oX7_QF6FxsLmKc1t2uNMN_%3DmvuutAXSGoYNkd6Q1Ft%3DdFbw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAK4qSCdwR07QOwbJt2xzdjteaGU1Q1DpMMsTAwUj3BrFJRK3uA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to