<commit_before>Django-SearchableListView
=========================

[![Build Status](https://travis-ci.org/SchroterQuentin/Django-SearchableListView.svg?branch=master)](https://travis-ci.org/SchroterQuentin/Django-SearchableListView)
[![Coverage Status](https://coveralls.io/repos/github/SchroterQuentin/Django-SearchableListView/badge.svg)](https://coveralls.io/github/SchroterQuentin/Django-SearchableListView)

ListView which can be searchable, paginate and which don't lose query parameter and page number

Installation
------------

This library need jQuery.
To install it in your vitualenv on your django project

    pip install django_search_model


Only paginate ListView
----------------------

    class ListDevicePaginate(SearchableListView):
        model = Device
        template_name = "tests/list.html"
        paginate_by = 10
        
Paginate + Searchable ListView
------------------------------

    class ListDeviceSearchablePaginate(SearchableListView):
        model = Device
        template_name = "tests/list.html"
        paginate_by = 10
        searchable_fields = ["inventory_number", "model_device", "model_device__brand__provider",
        "model_device__brand__name"]
        specifications = {
            "model_device__brand__name": "__icontains"
        }

Put the parameter for the query in **searchable_fields** which will be use to filter the queryset. The specifications which be use in the same way.

In the template
---------------

- In the header

        <link rel="stylesheet" href="{% static 'css/django_search_model.css' %}" >
<commit_msg>remove css unnecessary<commit_after>Django-SearchableListView
=========================

[![Build Status](https://travis-ci.org/SchroterQuentin/Django-SearchableListView.svg?branch=master)](https://travis-ci.org/SchroterQuentin/Django-SearchableListView)
[![Coverage Status](https://coveralls.io/repos/github/SchroterQuentin/Django-SearchableListView/badge.svg)](https://coveralls.io/github/SchroterQuentin/Django-SearchableListView)

ListView which can be searchable, paginate and which don't lose query parameter and page number

Installation
------------

This library need jQuery ( and Bootstrap for the frond-end ) 
To install it in your vitualenv on your django project

    pip install django_search_model


Only paginate ListView
----------------------

    class ListDevicePaginate(SearchableListView):
        model = Device
        template_name = "tests/list.html"
        paginate_by = 10
        
Paginate + Searchable ListView
------------------------------

    class ListDeviceSearchablePaginate(SearchableListView):
        model = Device
        template_name = "tests/list.html"
        paginate_by = 10
        searchable_fields = ["inventory_number", "model_device", "model_device__brand__provider",
        "model_device__brand__name"]
        specifications = {
            "model_device__brand__name": "__icontains"
        }

Put the parameter for the query in **searchable_fields** which will be use to filter the queryset. The specifications which be use in the same way.

In the template
---------------

{'fraction_non_alphanumeric': 0.1444586803331198, 'fraction_numerical': 0.0025624599615631004, 'mean_word_length': 3.191946308724832, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3240985', 'n_tokens_mistral': 880, 'n_tokens_neox': 840, 'n_words': 207}