projects/admin.py @ 444fa384fab8

Got a working photoblog (almost).
author Steve Losh <steve@stevelosh.com>
date Sat, 14 Feb 2009 12:39:39 -0500
parents c6f37ebd2f3e
children a3380ed37242
from stevelosh.projects.models import Project, ProjectFile, ProjectPhoto, Comment
from django.contrib import admin

class ProjectAdmin(admin.ModelAdmin):
    list_display = ('name', 'snip', 'type', 'posted',)
    search_fields = ('name', 'snip', 'body')
    list_filter = ('type',)
    date_hierarchy = 'posted'
    ordering = ('-posted',)
    prepopulated_fields = { 'slug': ('name',) }

class ProjectPhotoAdmin(admin.ModelAdmin):
    fields = ('title', 'description', 'project', 'position', 'photo')
    list_display = ('project', 'title', 'description', 'height', 'width')
    search_fields = ('title', 'description',)
    list_filter = ('project',)

class ProjectFileAdmin(admin.ModelAdmin):
    fields = ('title', 'description', 'project', 'file',)
    list_display = ('project', 'title', 'description',)
    search_fields = ('title', 'description',)
    list_filter = ('project',)

class CommentAdmin(admin.ModelAdmin):
    fields = ('name', 'body', 'submitted', 'project', 'spam')
    list_display = ('project', 'name', 'submitted', 'body', 'spam')
    search_fields = ('name', 'body')
    list_filter = ('name', 'project', 'spam')
    date_hierarchy = 'submitted'
    ordering = ('-submitted',)


admin.site.register(Project, ProjectAdmin)
admin.site.register(ProjectPhoto, ProjectPhotoAdmin)
admin.site.register(ProjectFile, ProjectFileAdmin)
admin.site.register(Comment, CommentAdmin)