Giter Site home page Giter Site logo

dashdrum / django-sortable-listview Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aptivate/django-sortable-listview

0.0 2.0 0.0 146 KB

An extension of django's ListView that provides sorting

License: MIT License

Python 89.85% HTML 10.15%

django-sortable-listview's Introduction

Build Status Coverage Status

django-sortable-listview

An extension of django's ListView that provides sorting.

Features:

  • Works with django's built in pagination.
  • Contains templates & css for pagination and sort buttons (or just use the context_data and build your own).
  • Adds an arrow to show the sort direction on the active sort.
  • Knows what the next sort is (i.e. if you're already sorted by title in one direction, clicking on the title button/link again will sort it in the other direction).
  • Lets you specify default sort for your list (defaults to -id) and for each of the sortable fields.
  • Modifies the queryset, so your database does your sorting.
  • Maintains additional query strings (configurable)

Requirements

* Python (2.6, 2.7, 3.2, 3.3, 3.4)
* Django (1.4, 1.5, 1.6, 1.7, 1.8)

(Tested against the latest version of each e.g. currently Python 2.7.4 & Django 1.5.12)

Install

Using pip::

pip install django-sortable-listview

If you want to use the provided temaplates and CSS add 'sortable_listview' to your INSTALLED_APPS in your django settings.

To see how to include the css and templates in your application, look at the example project. The css is just standard bootstrap.

Example Project

Screenshot of example project

To run the example project. First make sure django and django-sortable-listview are on your python path. For example, from inside a virtualenv::

pip install django
pip install django-sortable-listview

Then from your cloned folder::

cd example_project
python manage.py runserver

You should be able to see the example project at localhost:8000. A database is provided with some sample content. The username and password is admin/admin

Development and Tests

For your development setup::

pip install -r requirements-dev.txt

To run the tests::

tox

You may not want to run the whole tox suite when you are doing development. In this case, uncomment the extra lines in requirements-dev.txt, but please don't commit these changes. (Suggestions welcome on a better way to manage this)

django-sortable-listview's People

Contributors

birdsarah avatar dashdrum avatar fle avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.