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']) data = json.loads(request.POST['data'])
response = json_response() response = json_response()
if 'id' in data: 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() response['data'] = news.json()
else: else:
qs = models.News.objects.all().order_by('-date') qs = models.News.objects.all().order_by('-date')
@ -80,7 +80,7 @@ def removeNews(request):
''' '''
data = json.loads(request.POST['data']) data = json.loads(request.POST['data'])
response = json_response({}) 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): if news.editable(request.user):
news.delete() news.delete()
response = json_response(status=200, text='news removed') response = json_response(status=200, text='news removed')

View file

@ -232,11 +232,13 @@ pandora.URL = (function() {
findKeys: findKeys, findKeys: findKeys,
getItem: pandora.getItemByIdOrTitle, getItem: pandora.getItemByIdOrTitle,
getSpan: pandora.getMetadataByIdOrName, getSpan: pandora.getMetadataByIdOrName,
pages: [ pages: Ox.merge(
'about', 'api', 'contact', 'faq', 'help', 'home', 'news', ['home', 'software', 'api', 'help', 'tv'],
'preferences', 'rights', 'signin', 'signout', 'signup', pandora.site.sitePages.map(function(page) {
'software', 'terms', 'tour', 'tutorial', 'tv' return page.id;
], }),
['preferences', 'signup', 'signin', 'signout']
),
sortKeys: sortKeys, sortKeys: sortKeys,
spanType: spanType, spanType: spanType,
types: [pandora.site.itemName.plural.toLowerCase(), 'edits', 'texts'], types: [pandora.site.itemName.plural.toLowerCase(), 'edits', 'texts'],