from django db import models from tw mysite models import New from dja

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
from django.db import models
from tw.mysite.models import New
from django.core.paginator import Paginator
from django.shortcuts import render_to_response
def Newa(request):
news_list = New.objects.all()
paginator = Paginator(news_list, 3)
page = paginator.page(1)
return render_to_response("mysite/index.html", {'news':page.object_list})
def Newa(request, page_id=1):
news_list = New.objects.all()
paginator = Paginator(news_list, 3)
page = paginator.page(2)
return render_to_response("mysite/index.html", {'news':page.object_list})