annotate gpp/weblinks/admin.py @ 197:2baadae33f2e

Got autocomplete working for the member search. Updated django and ran into a bug where url tags with comma separated kwargs starting consuming tons of CPU throughput. The work-around is to cut over to using spaces between arguments. This is now allowed to be consistent with other tags. Did some query optimization for the news app.
author Brian Neal <bgneal@gmail.com>
date Sat, 10 Apr 2010 04:32:24 +0000
parents fa7d82bfb100
children b4305e18d3af
rev   line source
gremmie@1 1 """This file contains the automatic admin site definitions for the weblinks models"""
gremmie@1 2
gremmie@1 3 from django.contrib import admin
gremmie@1 4 from weblinks.models import Category
gremmie@1 5 from weblinks.models import Link
gremmie@1 6 from weblinks.models import FlaggedLink
gremmie@1 7
bgneal@193 8
bgneal@193 9 class CategoryAdmin(admin.ModelAdmin):
bgneal@193 10 list_display = ('title', 'description', 'count')
bgneal@193 11 readonly_fields = ('count', )
bgneal@193 12
bgneal@193 13
gremmie@1 14 class LinkAdmin(admin.ModelAdmin):
gremmie@1 15 list_display = ('title', 'url', 'category', 'date_added', 'hits', 'is_public')
gremmie@1 16 list_filter = ('date_added', 'is_public', 'category')
gremmie@1 17 date_hierarchy = 'date_added'
gremmie@1 18 ordering = ('-date_added', )
gremmie@1 19 search_fields = ('title', 'description', 'url', 'user__username')
gremmie@1 20 raw_id_fields = ('user', )
gremmie@1 21 save_on_top = True
gremmie@1 22
bgneal@193 23
gremmie@1 24 class FlaggedLinkAdmin(admin.ModelAdmin):
bgneal@165 25 list_display = ('__unicode__', 'url', 'get_link_url', 'user', 'date_flagged')
gremmie@1 26 date_hierarchy = 'date_flagged'
gremmie@1 27 raw_id_fields = ('user', )
gremmie@1 28
bgneal@193 29 admin.site.register(Category, CategoryAdmin)
gremmie@1 30 admin.site.register(Link, LinkAdmin)
gremmie@1 31 admin.site.register(FlaggedLink, FlaggedLinkAdmin)