view gpp/weblinks/admin.py @ 199:217119c87a06

Fix #72: update to 1.1.7 of the MarkItUp! editor.
author Brian Neal <bgneal@gmail.com>
date Sun, 11 Apr 2010 18:56:30 +0000
parents fa7d82bfb100
children b4305e18d3af
line wrap: on
line source
"""This file contains the automatic admin site definitions for the weblinks models"""

from django.contrib import admin
from weblinks.models import Category
from weblinks.models import Link
from weblinks.models import FlaggedLink


class CategoryAdmin(admin.ModelAdmin):
    list_display = ('title', 'description', 'count')
    readonly_fields = ('count', )


class LinkAdmin(admin.ModelAdmin):
    list_display = ('title', 'url', 'category', 'date_added', 'hits', 'is_public')
    list_filter = ('date_added', 'is_public', 'category')
    date_hierarchy = 'date_added'
    ordering = ('-date_added', )
    search_fields = ('title', 'description', 'url', 'user__username')
    raw_id_fields = ('user', )
    save_on_top = True


class FlaggedLinkAdmin(admin.ModelAdmin):
    list_display = ('__unicode__', 'url', 'get_link_url', 'user', 'date_flagged')
    date_hierarchy = 'date_flagged'
    raw_id_fields = ('user', )

admin.site.register(Category, CategoryAdmin)
admin.site.register(Link, LinkAdmin)
admin.site.register(FlaggedLink, FlaggedLinkAdmin)