Mercurial > public > sg101
comparison gpp/news/admin.py @ 486:7854d75427af
For #233, add a meta description field for news stories. This field will get put in the open graph meta tag for better descriptions when shared on social media sites.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Tue, 18 Oct 2011 23:23:42 +0000 |
parents | 53fdaf0da539 |
children |
comparison
equal
deleted
inserted
replaced
485:7c69b1449d7a | 486:7854d75427af |
---|---|
35 long_text=pending_story.long_text, | 35 long_text=pending_story.long_text, |
36 date_submitted=pending_story.date_submitted, | 36 date_submitted=pending_story.date_submitted, |
37 allow_comments=pending_story.allow_comments, | 37 allow_comments=pending_story.allow_comments, |
38 tags=pending_story.tags, | 38 tags=pending_story.tags, |
39 front_page_expiration=pending_story.front_page_expiration, | 39 front_page_expiration=pending_story.front_page_expiration, |
40 priority=pending_story.priority) | 40 priority=pending_story.priority, |
41 meta_description=pending_story.meta_description) | |
41 story.save() | 42 story.save() |
42 pending_story.delete() | 43 pending_story.delete() |
43 | 44 |
44 count = len(qs) | 45 count = len(qs) |
45 msg = "1 story" if count == 1 else "%d stories" % count | 46 msg = "1 story" if count == 1 else "%d stories" % count |
46 self.message_user(request, "%s approved." % msg) | 47 self.message_user(request, "%s approved." % msg) |
47 | 48 |
48 approve_story.short_description = "Approve selected pending stories" | 49 approve_story.short_description = "Approve selected pending stories" |
49 | 50 |
50 class Media: | 51 class Media: |
51 js = settings.GPP_THIRD_PARTY_JS['tiny_mce'] | 52 js = ['js/news_admin.js'] + settings.GPP_THIRD_PARTY_JS['tiny_mce'] |
52 | 53 |
53 | 54 |
54 class StoryAdmin(admin.ModelAdmin): | 55 class StoryAdmin(admin.ModelAdmin): |
55 list_display = ('title', 'date_submitted', 'submitter', 'category') | 56 list_display = ('title', 'date_submitted', 'submitter', 'category') |
56 list_filter = ('date_submitted', 'category') | 57 list_filter = ('date_submitted', 'category') |
58 date_hierarchy = 'date_submitted' | 59 date_hierarchy = 'date_submitted' |
59 readonly_fields = ('update_date', ) | 60 readonly_fields = ('update_date', ) |
60 raw_id_fields = ('submitter', ) | 61 raw_id_fields = ('submitter', ) |
61 | 62 |
62 class Media: | 63 class Media: |
63 js = settings.GPP_THIRD_PARTY_JS['tiny_mce'] | 64 js = ['js/news_admin.js'] + settings.GPP_THIRD_PARTY_JS['tiny_mce'] |
64 | 65 |
65 | 66 |
66 admin.site.register(Category, CategoryAdmin) | 67 admin.site.register(Category, CategoryAdmin) |
67 admin.site.register(Story, StoryAdmin) | 68 admin.site.register(Story, StoryAdmin) |
68 admin.site.register(PendingStory, PendingStoryAdmin) | 69 admin.site.register(PendingStory, PendingStoryAdmin) |