def prodazha_x(request): estate = Estates.objects.select_related().filter(show=True).order_by('type_estate','cost_value','cost') type_all = Type_estates.objects.select_related().all().order_by('title') type_have = type_all.filter(estates__isnull=False).values('title', 'slug_title').distinct() type_com = type_have.filter(estates__business=True) return render_to_response('estates/estates.html', { 'real': estate, 'real_com' : estate.filter(business=True), 'type_all' : type_all, 'type_have' : type_have, 'type_com' : type_com, 'type_other': type_have.exclude(id__in=[1,2,]), 'count_flat': estate.filter(type_estate=1).count(), 'count_home': estate.filter(type_estate=2 ).count(), 'count_com': estate.filter(business=True).count(), 'count_new': estate.filter(new=True).count(), 'count_other': estate.exclude(type_estate__id__in=[1,2,]).count(), }, context_instance = RequestContext(request) ) def kuplyu_x(request): buy = Buy.objects.select_related().filter(show=True).order_by('type_estate','cost_value','cost') type_all = Type_estates.objects.select_related().all().order_by('title') type_have = type_all.filter(buy__isnull=False).values('title', 'slug_title').distinct() type_com = type_have.filter(buy__business=True) return render_to_response('estates/estates.html', { 'real': buy, 'real_com' : buy.filter(business=True), 'type_all' : type_all, 'type_have' : type_have, 'type_com' : type_com, 'type_other': type_have.exclude(id__in=[1,2,]), 'count_flat': buy.filter(type_estate=1).count(), 'count_home': buy.filter(type_estate=2 ).count(), 'count_com': buy.filter(business=True).count(), 'count_new': buy.filter(new=True).count(), 'count_other': buy.exclude(type_estate__id__in=[1,2,]).count(), }, context_instance = RequestContext(request) )
вынести хотя бы часть, в контекст не всего проекта, а только приложения