Skip to main content
Django-SearchableListView
=========================

[![Build Status](https://travis-ci.org/SchroterQuentin/django-search-listview.svg?branch=master)](https://travis-ci.org/SchroterQuentin/django-search-listview)
[![Coverage Status](https://coveralls.io/repos/github/SchroterQuentin/Django-SearchableListView/badge.svg)](https://coveralls.io/github/SchroterQuentin/Django-SearchableListView)
[![Code Health](https://landscape.io/github/SchroterQuentin/django-search-listview/master/landscape.svg?style=flat)](https://landscape.io/github/SchroterQuentin/django-search-listview/master)

ListView which can be searchable, paginate and which doesn'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

```{r, engine='bash', count_lines}
pip install django-search-listview
```

```python
INSTALLED_APPS = [
...
'search_listview',
]
```


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

```python
from search_listview.list import SearchableListView

class ListDevicePaginate(SearchableListView):
model = Device
template_name = "tests/list.html"
paginate_by = 10
```

Paginate + Searchable ListView
------------------------------

```python
from search_listview.list import SearchableListView

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
---------------

- Where you want the pagination and the search box

```html
<div class="row">
{% include "search_listview/search_and_page.html" %}
</div>
```

- In the footer

```html
<!--Need jQuery-->
<script src="{% static 'search_listview/js/search_listview.js' %}"></script>
<script>
start_search()
</script>
```

Now you have a beautifull box with all the fields you need.

![Alt tag](/docs/search_box.png?raw=true "Search box")

Metadata

Release files for django-search-listview 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-search-listview 0.2.1
File Size Uploaded Provenance Actions
django-search-listview-0.2.1.zip 12.0 kB Without provenance Details for django-search-listview-0.2.1.zip

Release files / django-search-listview-0.2.1.zip

Download URL django-search-listview-0.2.1.zip
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b3354dff8a1d27c7b43f8471933a34329c2154639a2bccd76954ec114d31c0b2
BLAKE2b-256 checksum
How to use checksums
2503b2b71fea2e1c63083ffa60cf2a1a770c7b3d9e8942431615fe57b1a0568c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django-search-listview 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page