----
This library is aimed to simplify creation of user sorted lists.
Inspired by https://gist.github.com/piquadrat/3833430
Installation
----
1. Install with pip or setup.py
2. Add ordered_listview into `INSTALLED_APPS`. ::
INSTALLED_APPS += ['ordered__listview']
3. Add template tags lib into builtins. ::
add_to_builtins('ordered_listview.templatetags.ordered_listview') // Or load with {% load ordered_listview %}
4. Inherit your view from `OrderedListView`. And setup your ordering fields. ::
from ordered_listview import OrderedListView
class UserListView(OrderedListView):
allowed_order_by = [
('username', _('Login')),
('userfile__file__size', _('Size')),
('date_joined', _('Sing up date'))
]
default_order_by = 'created'
5. Add a tag into you your template. ::
{% include "ordered_listview/fields.html" %}
Customization
----
1. To change get attribute name, just set `OrderedListView.order_by` attribute ::
class UserListView(OrderedListView):
order_by = "order_by"
2. If you need to provide your own template create inside your `templates`
`ordered_listview` directory with `fields.html` and `field.html` in.
fields.html - list of sortable fields
field.html - order field and state template
3. If you want to ignore null values during sort, add fields to null_ignore_fields.
class UserListView(OrderedListView):
null_ignore_fields = ['quantity']
class UserListView(OrderedListView):
null_ignore_fields = '*' # For all fields
Metadata
Release files for django-ordered-listview 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-ordered-listview-0.0.2.tar.gz | 2.3 kB | Without provenance | Details for django-ordered-listview-0.0.2.tar.gz |
Release files / django-ordered-listview-0.0.2.tar.gz
| Download URL | django-ordered-listview-0.0.2.tar.gz |
|---|---|
| Size | 2.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4ede323c9a2a045c123ea30520effa00340aee7b27f60189d950ad894aa262b4
|
|
BLAKE2b-256 checksum How to use checksums |
c347374dabe0f36a1f0cee05a153ba440dd0903d952d0973d98b528712cad59d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-ordered-listview 0.0.2
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.