2011-06-02 19:39:14 -07:00
|
|
|
from django.contrib import admin
|
|
|
|
|
2011-06-05 08:55:27 -07:00
|
|
|
from snipts.models import Comment, Snipt
|
|
|
|
|
|
|
|
class CommentInline(admin.TabularInline):
|
|
|
|
model = Comment
|
|
|
|
extra = 0
|
|
|
|
allow_add = False
|
2011-06-02 19:39:14 -07:00
|
|
|
|
|
|
|
class SniptAdmin(admin.ModelAdmin):
|
|
|
|
list_display = ('title', 'slug', 'tags', 'user', 'lexer', 'public', 'created', 'modified',)
|
2011-06-05 08:55:27 -07:00
|
|
|
search_fields = ('title', 'user__username', 'tags', 'lexer', 'id',)
|
2011-06-02 19:39:14 -07:00
|
|
|
ordering = ('created',)
|
|
|
|
prepopulated_fields = {'slug': ('title',)}
|
2011-06-05 08:55:27 -07:00
|
|
|
inlines = [CommentInline]
|
|
|
|
|
2011-06-02 19:39:14 -07:00
|
|
|
admin.site.register(Snipt, SniptAdmin)
|
2011-06-05 08:55:27 -07:00
|
|
|
|
|
|
|
class CommentAdmin(admin.ModelAdmin):
|
|
|
|
list_display = ('comment', 'user', 'snipt', 'created', 'modified',)
|
|
|
|
search_fields = ('comment', 'user__username',)
|
|
|
|
ordering = ('created',)
|
|
|
|
|
|
|
|
admin.site.register(Comment, CommentAdmin)
|