1 # -*- coding: utf-8 -*-
2 from django.contrib import admin
4 from newtagging.admin import TaggableModelAdmin
5 from catalogue.models import Tag, Book, Fragment
8 class TagAdmin(admin.ModelAdmin):
9 list_display = ('name', 'slug', 'sort_key', 'category', 'has_description',)
10 list_filter = ('category',)
11 search_fields = ('name',)
14 prepopulated_fields = {'slug': ('name',), 'sort_key': ('name',),}
15 radio_fields = {'category': admin.HORIZONTAL}
18 class BookAdmin(TaggableModelAdmin):
21 list_display = ('title', 'slug', 'has_pdf_file', 'has_odt_file', 'has_html_file', 'has_description',)
22 search_fields = ('title',)
25 prepopulated_fields = {'slug': ('title',)}
28 class FragmentAdmin(TaggableModelAdmin):
31 list_display = ('book', 'anchor',)
32 ordering = ('book', 'anchor',)
35 admin.site.register(Tag, TagAdmin)
36 admin.site.register(Book, BookAdmin)
37 admin.site.register(Fragment, FragmentAdmin)