This library is aimed to simplify creation of user sorted lists.
Project description
About
This library is aimed to simplify creation of user sorted lists. Inspired by https://gist.github.com/piquadrat/3833430
Installation
Install with pip or setup.py
Add ordered_listview into INSTALLED_APPS.
INSTALLED_APPS += ['ordered__listview']
Add template tags lib into builtins.
add_to_builtins('ordered_listview.templatetags.ordered_listview') // Or load with {% load ordered_listview %}
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'
Add a tag into you your template.
{% include "ordered_listview/fields.html" %}
Customization
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Hashes for django-ordered-listview-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9b0889625b25fd7783fb2bd971c81be594236897ee9fb2e144c5e551e13f8ab |
|
MD5 | 2c8bf41afcfdfebb0a0d0dc120be3357 |
|
BLAKE2b-256 | 5028dcdb358067123bc715024ae7761c6ddd51aea4a62f6bf6b34044d9ede8e6 |