I have declared a table and want to fetch the row's value which is checked using checkboxfield. Any help, how can i write this event in my views so that everytime I select a row and hit submit button, it returns the row's values.Code goes like this:
class mytables(tables.Table):
new_database = tables.CheckBoxColumn()
student =tables.Column(accessor='Student')
Class = tables.Column(accessor='class')
And in my templates a submit button.
You need to choose a suitable value for the
CheckBoxColumn
. Generally if you're displaying a queryset, you'll use thepk
of each object for theCheckBoxColumn
. In your case this would look like:Then you'll need to render the table within a form, so that the user can submit the form, e.g.:
Then you'll need a view hooked up to
/someurl/
. In your case the view will need to look at thePOST
variableselection
: