Exemple #1
0
def index(request):
    boards_obj = boards.objects.all()
    article_obj = articles.objects.order_by('-publishDate').all()[:10]

    arr = getSession(request)
    arr["boardList"] = boards_obj
    arr["articleList"] = article_obj

    return render(request,'index.html', arr)
Exemple #2
0
def index(request):
    boards_obj = boards.objects.all()
    article_obj = articles.objects.order_by('-publishDate').all()[:10]

    arr = getSession(request)
    arr["boardList"] = boards_obj
    arr["articleList"] = article_obj

    return render(request, 'index.html', arr)
Exemple #3
0
def article(request, articleId):
    arr = getSession(request)
    articleId = int(articleId)
    articles_obj = articles.objects.filter(articleId=articleId)
    if articles_obj.count() == 0:
        return render(request, '404.html')
    articleObj = articles_obj[0]
    arr["article"] = articleObj

    replyList = replies.objects.filter(article__articleId=articleId)
    arr["replyList"] = replyList

    return render(request, 'article.html', arr)
Exemple #4
0
def article(request, articleId):
    arr = getSession(request)
    articleId = int(articleId)
    articles_obj = articles.objects.filter(articleId=articleId)
    if articles_obj.count() == 0:
        return render(request, '404.html')
    articleObj = articles_obj[0]
    arr["article"] = articleObj


    replyList = replies.objects.filter(article__articleId=articleId)
    arr["replyList"] = replyList

    return render(request, 'article.html', arr)
Exemple #5
0
def board(request, boardNameFilter, pageNo=1):
    arr = getSession(request)
    board = boards.objects.filter(boardName=boardNameFilter)[0]
    if pageNo == u'':
        pageNo = u'1'
    pageNo = int(pageNo)
    if pageNo < 1:
        pageNo = 1
    startIndex = (pageNo - 1) * 20 + 1
    endIndex = pageNo * 20
    articles_obj = board.articles_set.all()[startIndex:endIndex]

    arr["board"] = board
    arr["articleList"] = articles_obj
    return render(request,'boardList.html', arr)
Exemple #6
0
def board(request, boardNameFilter, pageNo=1):
    arr = getSession(request)
    board = boards.objects.filter(boardName=boardNameFilter)[0]
    if pageNo == u'':
        pageNo = u'1'
    pageNo = int(pageNo)
    if pageNo < 1:
        pageNo = 1
    startIndex = (pageNo - 1) * 20 + 1
    endIndex = pageNo * 20
    articles_obj = board.articles_set.all()[startIndex:endIndex]

    arr["board"] = board
    arr["articleList"] = articles_obj
    return render(request, 'boardList.html', arr)