from brandaxe main models import Page Job SiteOptions Customer Section

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from brandaxe.main.models import Page, Job, SiteOptions, Customer, Section, JobDescriptionText, JobDescriptionImage
from django.shortcuts import render_to_response
from django.http import HttpResponseRedirect
def view_index_page(request):
return render_to_response("index.html")
def view_portfolio(request):
return HttpResponseRedirect("/portfolio/logos/")
def view_section(request, section_name):
section = Section.objects.get(pk = section_name)
jobs_qset = Job.objects.filter(section = section_name).order_by('-date') #returns QuerySet
count = jobs_qset.count() # понадобиться чуть позже.
q_columns = xrange(3)
q_lines = count / 3 # ���������� �������� � �������� количество столбцов в таблике == 3
if (count % 3) != 0:
q_lines = q_lines + 1
q_lines = xrange(q_lines)
return render_to_response(str(section_name)+"_section.html", {
"section":section, "count":count, "jobs_qset":jobs_qset,
"q_lines":q_lines, "q_columns":q_columns
})