]> gitweb.fperrin.net Git - djsite.git/blobdiff - quotes/admin.py
Better implement tags, with separate namespaces
[djsite.git] / quotes / admin.py
index 7e8f1adfb3a778ba4174032b6b06b8215e300ecd..4e225dc04af88764bac5b4283c33bcc5cc44b870 100644 (file)
@@ -1,8 +1,26 @@
 from django.contrib import admin
 
 # Register your models here.
-from .models import Tag, Author, Work, Quote
-admin.site.register(Tag)
-admin.site.register(Author)
-admin.site.register(Work)
-admin.site.register(Quote)
+from .models import AuthorTag, WorkTag, QuoteTag, Author, Work, Quote
+
+@admin.register(Author)
+class AuthorAdmin(admin.ModelAdmin):
+    fields = ('name', 'birth_date', 'death_date', 'tags',
+              'notes', 'pvt_notes', 'creation_date', 'last_modification')
+    readonly_fields = ('creation_date', 'last_modification')
+
+@admin.register(Work)
+class WorkAdmin(admin.ModelAdmin):
+    fields = ('name', 'author', 'date', 'tags',
+              'notes', 'pvt_notes', 'creation_date', 'last_modification')
+    readonly_fields = ('creation_date', 'last_modification')
+
+@admin.register(Quote)
+class QuoteAdmin(admin.ModelAdmin):
+    fields = ('text', 'work', 'tags',
+              'notes', 'pvt_notes', 'creation_date', 'last_modification')
+    readonly_fields = ('creation_date', 'last_modification')
+
+admin.site.register(AuthorTag)
+admin.site.register(WorkTag)
+admin.site.register(QuoteTag)