Hi,

Django noob here, am stuck and can not find an example to help me past my 
error.

Using the tutorial 
(https://django-tables2.readthedocs.io/en/latest/pages/tutorial.html) have 
managed to display the table.
Could now like to add a checkbox to each row, so the user can select 
multiple rows and then select a button at the bottom of the table for 
further processing of those rows.
But am getting following error  Exception Type: Key Error Exception Value: 
'selection'

*tables.py*

import django_tables2 as tables
from .models import Person

class PersonTable(tables.Table):
    class Meta:
        model = Person
        #selection = tables.CheckBoxColumn(accessor="pk", attrs = { 
"th__input": {"onclick": "toggle(this)"}}, orderable=False)
       * selection = tables.CheckBoxColumn(accessor='pk', orderable=False)*
        attrs = {'class': 'paleblue'}
        sequence = ('...', '*selection*')


*views.py*
def people(request):
#return render(request, 'application/people.html', {'people': 
Person.objects.all()})
table = PersonTable(Person.objects.all())
RequestConfig(request).configure(table)
return render(request, 'application/people.html', {'table': table})


Regards,
Thorsten

-- 
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 post to this group, send email to django-users@googlegroups.com.
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/8affc1ec-b0b3-4120-b06a-9d4ee757d130%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to