From 5599b933d8433de1ab332a1564a547493b53e06f Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Sat, 18 Feb 2012 15:39:53 +0000 Subject: [PATCH] use sitePages instead of static list --- pandora/news/views.py | 4 ++-- static/js/pandora/URL.js | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/pandora/news/views.py b/pandora/news/views.py index e69e1a29f..dd653b95c 100644 --- a/pandora/news/views.py +++ b/pandora/news/views.py @@ -33,7 +33,7 @@ def getNews(request): data = json.loads(request.POST['data']) response = json_response() if 'id' in data: - news = models.News.objects.get(pk=ox.fromAZ(data['id'])) + news = get_object_or_404_json(models.News, id=ox.fromAZ(data['id'])) response['data'] = news.json() else: qs = models.News.objects.all().order_by('-date') @@ -80,7 +80,7 @@ def removeNews(request): ''' data = json.loads(request.POST['data']) response = json_response({}) - news = models.News.objects.get(id=ox.fromAZ(data['id'])) + news = get_object_or_404_json(models.News, id=ox.fromAZ(data['id'])) if news.editable(request.user): news.delete() response = json_response(status=200, text='news removed') diff --git a/static/js/pandora/URL.js b/static/js/pandora/URL.js index e4583e267..a7a2efa30 100644 --- a/static/js/pandora/URL.js +++ b/static/js/pandora/URL.js @@ -232,11 +232,13 @@ pandora.URL = (function() { findKeys: findKeys, getItem: pandora.getItemByIdOrTitle, getSpan: pandora.getMetadataByIdOrName, - pages: [ - 'about', 'api', 'contact', 'faq', 'help', 'home', 'news', - 'preferences', 'rights', 'signin', 'signout', 'signup', - 'software', 'terms', 'tour', 'tutorial', 'tv' - ], + pages: Ox.merge( + ['home', 'software', 'api', 'help', 'tv'], + pandora.site.sitePages.map(function(page) { + return page.id; + }), + ['preferences', 'signup', 'signin', 'signout'] + ), sortKeys: sortKeys, spanType: spanType, types: [pandora.site.itemName.plural.toLowerCase(), 'edits', 'texts'],