Changeset 2536
- Timestamp:
- 02/18/10 17:29:57 (5 months ago)
- Location:
- branches/0.9/pylucid_project/pylucid_plugins/update_journal
- Files:
-
- 2 modified
-
templates/update_journal/update_journal_table.html (modified) (1 diff)
-
views.py (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.9/pylucid_project/pylucid_plugins/update_journal/templates/update_journal/update_journal_table.html
r2468 r2536 37 37 {% endfor %} 38 38 </table> 39 {% if select_feed_url %} 40 <a href="{{ select_feed_url }}" class="select_feeds" title="{% trans "select update journal feed format" %}"> 41 {% trans "get update journal as RSS/Atom feed." %} 42 </a> 43 {% endif %} 39 44 {% else %} 40 45 <p>No updates recorded in update journal.</p> -
branches/0.9/pylucid_project/pylucid_plugins/update_journal/views.py
r2530 r2536 25 25 from django.utils.translation import ugettext_lazy as _ 26 26 from django.utils.feedgenerator import Rss201rev2Feed, Atom1Feed 27 from django.core.urlresolvers import NoReverseMatch 27 28 28 29 from pylucid_project.apps.pylucid.models import Language … … 30 31 31 32 from pylucid_project.pylucid_plugins.update_journal.models import UpdateJournal 32 33 from pylucid_project.apps.pylucid.models import PluginPage 33 34 34 35 def _get_queryset(request, count): … … 41 42 if not request.user.is_staff: 42 43 queryset = queryset.filter(staff_only=False) 43 44 44 45 return queryset[:count] 45 46 … … 50 51 count = int(count) 51 52 except Exception, e: 52 if request.user.is_st uff():53 if request.user.is_staff: 53 54 request.page_msg.error("page_update_list error: count must be a integer (%s)" % e) 54 55 count = 10 … … 56 57 queryset = _get_queryset(request, count) 57 58 58 return {"update_list": queryset} 59 try: 60 select_feed_url = PluginPage.objects.reverse("update_journal", "UpdateJournal-select_feed") 61 except NoReverseMatch, err: 62 select_feed_url = None 63 if settings.DEBUG is not None and request.user.is_staff: 64 # PluginPage.objects.reverse creates a page_msg only in DEBUG mode. 65 request.page_msg.error(err) 66 67 context = { 68 "update_list": queryset, 69 "select_feed_url": select_feed_url 70 } 71 return context 59 72 60 73 … … 62 75 feed_type = Rss201rev2Feed 63 76 filename = "feed.rss" 64 77 65 78 title = "Update Journal" 66 79 link = "/" 67 80 description = "Updates and changes" 68 81 description_template = "update_journal/feed_description.html" 69 82 70 83 def __init__(self, request): 71 84 self.count = 10 # FIXME: use GET parameter? … … 77 90 def item_title(self, item): 78 91 return item.title 79 92 80 93 def item_link(self, item): 81 94 return item.object_url … … 102 115 context = {"feeds": FEEDS} 103 116 return context 104 117 105 118 106 119 def feed(request, filename): … … 112 125 if filename == feed_class.filename: 113 126 break 114 127 115 128 #print "feed class:", feed_class 116 129 feed = feed_class(request) 117 130 response = feed(request) 118 131 return response 119