def news_item(request, news_id = None, format='html'): area = 'news' news = api.news_get(news_id = news_id) if format == 'html': return api.response_get(request, locals(), 'news/templates/item.html')
def news_remove(request, news_id = None, format='html'): area = 'news' news = api.news_get(news_id = news_id) tournament_id = news["tournament_id"]["id"] if request.POST and request.is_owner: api.news_remove(news_id = news_id) return http.HttpResponseRedirect("/tournament/"+ tournament_id + "/")
def news_edit(request, news_id = None, format='html'): if not request.is_owner: return http.HttpResponseRedirect("/news/" + news_id + "/") if request.POST and request.is_owner: name = request.POST.get("name") content = request.POST.get("content") item = api.news_edit(news_id = news_id, name = name, content = content) return http.HttpResponseRedirect("/news/" + news_id + "/") news = api.news_get(news_id = news_id) if not news: return http.HttpResponse() area = 'news' if format == 'html': return api.response_get(request, locals(), 'news/templates/edit.html')