{ "info": { "author": "MigueMLM", "author_email": "miguellm@lecrintech.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.11", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "DataTablesForm\n==============\n\nDataTablesForm is a simple Django app for connecting the datatables 1.10 js plugin with a standard django ModelForm.\n\nQuick start\n-----------\n\n1. Add \"datatablesform\" to your INSTALLED_APPS setting like this::\n\n INSTALLED_APPS = [\n ...\n 'datatablesform',\n ]\n\n2. Create a form inheriting from DataTablesForm::\n\n from datatablesform import forms \n ....\n class MyModelForm(forms.DataTablesForm):\n list_display = ['field1', 'field2', 'fk_field__field', 'class_method_with_allow_tags\"]\n \n class Meta:\n model = MyModel\n fields = '__all__'\n\n3. Use the previous form in any view::\n \n def my_form_view(request):\n ....\n form = MyModelForm()\n #_filters = {k,v for k,v in any_model_filter_wanted}\n #_exclude = {k,v for k,v in any_model_exclude_filter_wanted}\n script_table = form.factory_table() #form.factory_table(_filters, _exclude)\n table = 'MyModel'\n return render(request, \"my_form_template.html\", locals())\n\n\n4. Be aware of having the needed datatables static files in your \"my_form_template\", also you'll need to create a table element and include the script_table::\n \n \n ....\n