annotate gpp/weblinks/admin.py @ 165:952e05cb3d80
Implement #49; use POST for updating link hit counts. Also refactored a bit and use javascript to report broken links.
author |
Brian Neal <bgneal@gmail.com> |
date |
Sun, 03 Jan 2010 04:15:14 +0000 |
parents |
dbd703f7d63a |
children |
fa7d82bfb100 |
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
|
gremmie@1
|
8 class LinkAdmin(admin.ModelAdmin):
|
gremmie@1
|
9 list_display = ('title', 'url', 'category', 'date_added', 'hits', 'is_public')
|
gremmie@1
|
10 list_filter = ('date_added', 'is_public', 'category')
|
gremmie@1
|
11 date_hierarchy = 'date_added'
|
gremmie@1
|
12 ordering = ('-date_added', )
|
gremmie@1
|
13 search_fields = ('title', 'description', 'url', 'user__username')
|
gremmie@1
|
14 raw_id_fields = ('user', )
|
gremmie@1
|
15 save_on_top = True
|
gremmie@1
|
16
|
gremmie@1
|
17 class FlaggedLinkAdmin(admin.ModelAdmin):
|
bgneal@165
|
18 list_display = ('__unicode__', 'url', 'get_link_url', 'user', 'date_flagged')
|
gremmie@1
|
19 date_hierarchy = 'date_flagged'
|
gremmie@1
|
20 raw_id_fields = ('user', )
|
gremmie@1
|
21
|
gremmie@1
|
22 admin.site.register(Category)
|
gremmie@1
|
23 admin.site.register(Link, LinkAdmin)
|
gremmie@1
|
24 admin.site.register(FlaggedLink, FlaggedLinkAdmin)
|