Adds Boolean like Filter in Admin to OneToOneField reference. Allowing to filter in the Parent for instances without Referenced Field.
To register the filter, import in `urls.py` for example:
import filterspecs
Example `models.py`:
from django.db import models
class Place(models.Model):
name = model.CharField(maxlength=50)
address = model.CharField(maxlength=80)
class Restaurant(meta.Model):
place = model.OneToOneField(Place)
place.exists_filter = True
serves_hot_dogs = model.BooleanField()
serves_pizza = model.BooleanField()
Example `admin.py`:
from django.contrib import admin
from models import *
class PlaceAdmin(admin.ModelAdmin):
list_filter = ('restaurant',)
admin.site.register(Place, PlaceAdmin)
With this example PlaceAdmin will have a filter:
By Restaurant
All
Yes
No
Where `Yes` will list `Place` with `Restaurant` instances, and `No` will list `Place` without `Restaurant` instances.
- admin
- filters
- OneToOneField