django-naturalsortfield 0.1

Better ordering for Django CharFields
django-naturalsortfield is a Django app that provides better ordering for CharFields. Ignores spaces at the start of a string, does the right thing with integers, scorns the word "the".

Example:

    >>> from django.db import models
    >>> from naturalsortfield import NaturalSortField
    ...
    >>> class MyModel(models.Model):
    ...     title = models.CharField(max_length=255)
    ...     title_sort = NaturalSortField()
    ...
    >>> MyModel.objects.create(title='ABC')
    >>> MyModel.objects.create(title='XYZ 1')
    >>> MyModel.objects.create(title='The XYZ 2')
    >>> MyModel.objects.create(title='XYZ 10')
    >>> [obj.title for obj.title in MyModel.objects.order_by('title_sort')
    ['ABC', 'XYZ 1', 'The XYZ 2', 'XYZ 10']

last updated on:
October 29th, 2011, 0:12 GMT
price:
FREE!
developed by:
Nathan Reynolds
homepage:
github.com
license type:
Other/Proprietary License
category:
ROOT \ Internet \ HTTP (WWW)

FREE!

In a hurry? Add it to your Download Basket!

user rating

UNRATED
0.0/5
 

0/5

Rate it!

Add your review!

SUBMIT