Skip to content

Instantly share code, notes, and snippets.

View aherok's full-sized avatar

Andrzej Herok aherok

View GitHub Profile
@tourist
tourist / custom_filterspec.py
Created May 17, 2012 08:09
FilterSpec custom queryset for Django 1.3
# models.py
class Link(models.Model):
.....
place = models.ManyToManyField("PlaceForLink", through="LinkPlace", related_name="link")
.....
place.hasplace_filter = True
# filters.py
class HasPlaceFilterSpec(FilterSpec):
def __init__(self, f, request, params, model, model_admin, field_path=None):