Metadata-Version: 2.1
Name: django-datatablesform
Version: 0.1
Summary: A simple Django app for connecting the datatables 1.10 js plugin with a standard django ModelForm.
Home-page: UNKNOWN
Author: MigueMLM
Author-email: miguellm@lecrintech.com
License: BSD License
Description: DataTablesForm
        ==============
        
        DataTablesForm is a simple Django app for connecting the datatables 1.10 js plugin with a standard django ModelForm.
        
        Quick start
        -----------
        
        Before everything else you will have to clone this repository and install the app in your python environment::
        
                pip install dist/django-datatablesform-0.1.tar.gz
        
        1. Add "datatablesform" to your INSTALLED_APPS setting like this::
        
                INSTALLED_APPS = [
                    ...
                    'datatablesform',
                ]
        
        2. Create a form inheriting from DataTablesForm::
        
                from datatablesform import forms 
                ....
                class MyModelForm(forms.DataTablesForm):
                    list_display = ['field1', 'field2', 'fk_field__field', 'class_method_with_allow_tags"]
                
                    class Meta:
                        model = MyModel
                        fields = '__all__'
        
        3. Use the previous form in any view::
            
                def my_form_view(request):
                    ....
                    form = MyModelForm()
                    #_filters = {k,v for k,v in any_model_filter_wanted}
                    #_exclude = {k,v for k,v in any_model_exclude_filter_wanted}
                    script_table = form.factory_table() #form.factory_table(_filters, _exclude)
                    table = 'MyModel'
                    return render(request, "my_form_template.html", locals())
        
        
        4. 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::
            
                <link href="your_static_dir" rel="stylesheet"/>
                ....
                <table class="dataTable" id="table-{{table}}"></table>
                ....
                <script src="your_static_dir">...</script>
                ....
                {{script_table|safe}}
        
        5. You can always make an ajax request to retrieve the script or use the code to your best.
        
        
Platform: UNKNOWN
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 1.11
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Description-Content-Type: text/x-rst
