1 # -*- coding: utf-8 -*-
2 from django.contrib import admin
3 from django import forms
4 from django.utils.safestring import mark_safe
5 from django.utils.translation import ugettext_lazy as _
7 from newtagging.admin import TaggableModelAdmin
8 from catalogue.models import Book, Tag
11 class TagAdmin(admin.ModelAdmin):
12 list_display = ('name', 'slug', 'sort_key', 'category', 'has_description',)
13 list_filter = ('category',)
14 search_fields = ('name',)
17 prepopulated_fields = {'slug': ('name',), 'sort_key': ('name',),}
18 radio_fields = {'category': admin.HORIZONTAL}
20 admin.site.register(Tag, TagAdmin)
23 class BookAdmin(TaggableModelAdmin):
26 list_display = ('title', 'slug', 'has_pdf_file', 'has_odt_file', 'has_html_file', 'has_description',)
27 search_fields = ('title',)
30 prepopulated_fields = {'slug': ('title',)}
32 admin.site.register(Book, BookAdmin)