Mercurial > public > sg101
comparison gpp/news/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 | 1246a4f1ab4f |
children | 7c7201f942fe |
comparison
equal
deleted
inserted
replaced
276:8a46843c258f | 277:d424b8bae71d |
---|---|
20 list_display = ('title', 'date_submitted', 'submitter') | 20 list_display = ('title', 'date_submitted', 'submitter') |
21 list_filter = ('date_submitted', ) | 21 list_filter = ('date_submitted', ) |
22 search_fields = ('title', 'short_text', 'long_text') | 22 search_fields = ('title', 'short_text', 'long_text') |
23 date_hierarchy = 'date_submitted' | 23 date_hierarchy = 'date_submitted' |
24 actions = ('approve_story', ) | 24 actions = ('approve_story', ) |
25 readonly_fields = ('update_date', ) | |
25 | 26 |
26 def approve_story(self, request, qs): | 27 def approve_story(self, request, qs): |
27 for pending_story in qs: | 28 for pending_story in qs: |
28 story = Story( | 29 story = Story( |
29 title=pending_story.title, | 30 title=pending_story.title, |
30 submitter=pending_story.submitter, | 31 submitter=pending_story.submitter, |
31 category=pending_story.category, | 32 category=pending_story.category, |
32 short_text=pending_story.short_text, | 33 short_text=pending_story.short_text, |
33 long_text=pending_story.long_text, | 34 long_text=pending_story.long_text, |
34 date_submitted=datetime.datetime.now(), | 35 date_submitted=pending_story.date_submitted, |
35 allow_comments=pending_story.allow_comments, | 36 allow_comments=pending_story.allow_comments, |
36 tags=pending_story.tags, | 37 tags=pending_story.tags, |
37 front_page_expiration=pending_story.front_page_expiration) | 38 front_page_expiration=pending_story.front_page_expiration) |
38 story.save() | 39 story.save() |
39 pending_story.delete() | 40 pending_story.delete() |
47 class StoryAdmin(admin.ModelAdmin): | 48 class StoryAdmin(admin.ModelAdmin): |
48 list_display = ('title', 'date_submitted', 'submitter', 'category') | 49 list_display = ('title', 'date_submitted', 'submitter', 'category') |
49 list_filter = ('date_submitted', 'category') | 50 list_filter = ('date_submitted', 'category') |
50 search_fields = ('title', 'short_text', 'long_text') | 51 search_fields = ('title', 'short_text', 'long_text') |
51 date_hierarchy = 'date_submitted' | 52 date_hierarchy = 'date_submitted' |
53 readonly_fields = ('update_date', ) | |
52 | 54 |
53 class Media: | 55 class Media: |
54 js = settings.GPP_THIRD_PARTY_JS['tiny_mce'] | 56 js = settings.GPP_THIRD_PARTY_JS['tiny_mce'] |
55 | 57 |
56 | 58 |