Code layout change.
[wolnelektury.git] / src / pdcounter / admin.py
diff --git a/src/pdcounter/admin.py b/src/pdcounter/admin.py
new file mode 100644 (file)
index 0000000..e2e3fc3
--- /dev/null
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
+from django.contrib import admin
+
+from pdcounter.models import BookStub, Author
+
+
+class BookStubAdmin(admin.ModelAdmin):
+    list_display = ('title', 'author', 'slug', 'pd')
+    search_fields = ('title', 'author')
+    ordering = ('title',)
+
+    prepopulated_fields = {'slug': ('title',)}
+
+class AuthorAdmin(admin.ModelAdmin):
+    list_display = ('name', 'slug', 'death')
+    search_fields = ('name',)
+    ordering = ('sort_key', 'name')
+
+    prepopulated_fields = {'slug': ('name',), 'sort_key': ('name',),}
+
+
+admin.site.register(BookStub, BookStubAdmin)
+admin.site.register(Author, AuthorAdmin)