# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.shortcuts import render
from django.views.generic.base import View

from .models import Posts
from register.models import UserInfo
# Create your views here.


class AllPosts(View):
	def get(self, request):
		all_posts = Posts.objects.all()
		
		return render(request, 'community.html', {
			"all_posts":all_posts,
			})
@@ -138,16 +138,83 @@
 t View%0A%0A
+from pure_pagination import Paginator, EmptyPage, PageNotAnInteger%0A
 from .mo
@@ -386,75 +386,487 @@
 %09%0A%09%09
-return render(request, 'community.html', %7B%0A%09%09%09%22all_posts%22:all_posts
+animal_kind = request.GET.get('animal', '')%0A%09%09post_kind = request.GET.get('kind', '')%0A%09%09if animal_kind and post_kind:%0A%09%09%09all_posts = all_posts.filter(animal_cate=animal_kind, post_cate=post_kind)%0A%0A%09%09try:%0A%09%09%09page = request.GET.get('page', 1)%0A%09%09except PageNotAnInteger:%0A%09%09%09page = 1%0A%0A%09%09p = Paginator(all_posts, 7, request=request)%0A%09%09posts = p.page(page)%0A%0A%09%09return render(request, 'community.html', %7B%0A%09%09%09%22all_posts%22 : posts,%0A%09%09%09%22animal_kind%22 : animal_kind,%0A%09%09%09%22post_kind%22 : post_kind
 ,%0A%09%09

add pagination and filter(bugs)