예제 #1
0
파일: views.py 프로젝트: uve/onarena
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') 
예제 #2
0
파일: views.py 프로젝트: uve/onarena
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 + "/")
예제 #3
0
파일: views.py 프로젝트: uve/onarena
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')