Skip to content

Commit

Permalink
Adding files needed for upload to PyPI. Thanks to https://github.com/…
Browse files Browse the repository at this point in the history
…smacker for the setup file!
  • Loading branch information
Rune Kaagaard committed Nov 23, 2011
1 parent 5a38613 commit bfe14bd
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 1 deletion.
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
include README.markdown
recursive-include filtrate *.py *.js *.css *.jpg *.png *.gif *.html
42 changes: 41 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,48 @@
This Django app makes it easier to create custom filters in the change list of
Django Admin and supplies a `TreeFilter` and a `DateRangeFilter` too. Se below.

Tested on Django 1.2.3 but 1.3 support is coming too thx to TimFletcher.
Tested on Django 1.2.3 and from @15ea9a9 1.3.1.

## Updating to 1.3 support ##
I will write proper docs, things are getting messy here, but here is the
lowdown.

### New settings required ###
As I found out, you can't reliably convert the django date formats to
Datepicker formats. So this commit introduces these two new settings:

FILTRATE = {
# See http://jqueryui.com/demos/datepicker/#localization.
'datepicker_region': 'en-GB',
# See http://docs.jquery.com/UI/Datepicker/formatDate.
'datepicker_date_format': 'yy-mm-dd',
}

So if the above defaults does not suit you, you have to change them your self.
Check out the Datepicker documentation to see how to use them.

### lookup_allowed() ###
Django 1.2.4 introduces restrictions on which lookups that can be queried
in the url, so at the moment the end user are responsible for
checking for those, as in this example:

class CaseAdmin(admin.ModelAdmin):
list_filter = ['client']

def lookup_allowed(self, key, *args, **kwargs):
if 'client__start_date' in key:
return True
else:
return super(CaseAdmin, self).lookup_allowed(key, *args, **kwargs)

### Undefined Media() class bug ###
Time and my Python meta-fu is running out, and I couldn't fix it
so its not neccessary to define an empty Media() class as in:

class CaseAdmin(admin.ModelAdmin):
class Media():
pass
## The FiltrateFilter ##
The base class that adds support for custom html in the content of the filter
and for using `Media()` classes.
Expand Down
26 changes: 26 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python
# coding=utf8

from setuptools import setup, find_packages
import os

static_files = []
for root, subFolders, files in os.walk("filtrate/static"):
for f in files:
path = os.path.join(root, f)
# Remove 'filtrate/'
path = path[9:]
static_files.append(path)

setup(
name='django-admin-filtrate',
version='0.1.0',
author='Rune Kaagaard',
author_email='[email protected]',
description='This Django app makes it easier to create custom filters in the change list of Django Admin and supplies a TreeFilter and a DateRangeFilter too.',
long_description=open('README.markdown').read(),
license='MIT',
url='https://github.com/runekaagaard/django-admin-filtrate',
packages=find_packages(),
package_data = {'filtrate': ['templates/admin/*'] + static_files },
)

0 comments on commit bfe14bd

Please sign in to comment.