use sitePages instead of static list

This commit is contained in:
j 2012-02-18 15:39:53 +00:00
parent 747b9c70f9
commit 5599b933d8
2 changed files with 9 additions and 7 deletions

View file

@ -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')

View file

@ -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'],