Mercurial > public > sg101
comparison gpp/weblinks/admin.py @ 277:d424b8bae71d
Fixing #128 and #129. Add elsewhere weblinks to search content. Add support for haystack's get_update_field() method.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 02 Oct 2010 23:24:39 +0000 |
parents | 7e8d2dda99e3 |
children | 701730b2fcda |
comparison
equal
deleted
inserted
replaced
276:8a46843c258f | 277:d424b8bae71d |
---|---|
16 | 16 |
17 class PendingLinkAdmin(admin.ModelAdmin): | 17 class PendingLinkAdmin(admin.ModelAdmin): |
18 list_display = ('title', 'url', 'user', 'category', 'date_added') | 18 list_display = ('title', 'url', 'user', 'category', 'date_added') |
19 raw_id_fields = ('user', ) | 19 raw_id_fields = ('user', ) |
20 actions = ('approve_links', ) | 20 actions = ('approve_links', ) |
21 readonly_fields = ('update_date', ) | |
21 | 22 |
22 def approve_links(self, request, qs): | 23 def approve_links(self, request, qs): |
23 for pending_link in qs: | 24 for pending_link in qs: |
24 link = Link(category=pending_link.category, | 25 link = Link(category=pending_link.category, |
25 title=pending_link.title, | 26 title=pending_link.title, |
40 list_filter = ('date_added', 'is_public', 'category') | 41 list_filter = ('date_added', 'is_public', 'category') |
41 date_hierarchy = 'date_added' | 42 date_hierarchy = 'date_added' |
42 ordering = ('-date_added', ) | 43 ordering = ('-date_added', ) |
43 search_fields = ('title', 'description', 'url', 'user__username') | 44 search_fields = ('title', 'description', 'url', 'user__username') |
44 raw_id_fields = ('user', ) | 45 raw_id_fields = ('user', ) |
46 readonly_fields = ('update_date', ) | |
45 save_on_top = True | 47 save_on_top = True |
46 | 48 |
47 | 49 |
48 class FlaggedLinkAdmin(admin.ModelAdmin): | 50 class FlaggedLinkAdmin(admin.ModelAdmin): |
49 list_display = ('__unicode__', 'url', 'get_link_url', 'user', 'date_flagged') | 51 list_display = ('__unicode__', 'url', 'get_link_url', 'user', 'date_flagged') |