Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.contrib import admin
- from django import forms
- from models import *
- from filters import CategoryFilterSpec
- from django.contrib.admin.filterspecs import FilterSpec
- def test_f(f):
- return getattr(f, 'name')=='parent' and f.rel.to == Category
- FilterSpec.filter_specs.insert(0, (test_f, CategoryFilterSpec))
- class TagAdmin(admin.ModelAdmin):
- # form = TagAdminForm
- list_display = ( 'slug', 'parent')
- list_filter = ( 'parent', )
- admin.site.register(Category)
- admin.site.register(Tag, TagAdmin)
- admin.site.register(TestModel)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement