summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'python/tbc_www/views.py')
-rw-r--r--python/tbc_www/views.py89
1 files changed, 86 insertions, 3 deletions
diff --git a/python/tbc_www/views.py b/python/tbc_www/views.py
index dcc89d4..252998e 100644
--- a/python/tbc_www/views.py
+++ b/python/tbc_www/views.py
@@ -6,8 +6,8 @@ from django.conf import settings
from gentoo_www.models import SiteSettings, Layout, Pages, SubPages, Sponsors, Posts
from tbc_www.models import EbuildsMetadata, BuildLogs, BuildJobs, BuildLogsRepomanQa, \
- BuildJobsUse
-
+ BuildJobsUse, Categories, CategoriesMetadata, Packages, PackagesMetadata, Ebuilds, \
+ Repos
import re
def default_TmpDict(pagerequest):
@@ -29,7 +29,90 @@ def default_TmpDict(pagerequest):
def home(request):
pagerequest = 'home'
- Lines = 10
+ Lines = 5
+ adict = {}
+ TmpDict = default_TmpDict(pagerequest)
+ TmpDict['EM'] = EbuildsMetadata.objects.filter(Revision = '1.1').order_by('-Id')[:Lines]
+ TmpDict['BL'] = BuildLogs.objects.order_by('-TimeStamp')[:Lines]
+ BJ_Tmp = BuildJobs.objects.order_by('-TimeStamp')[:Lines]
+ for BJ in BJ_Tmp:
+ adict2 = {}
+ adict2['EbuildId'] = BJ.EbuildId.EbuildId
+ adict2['C'] = BJ.EbuildId.PackageId.CategoryId.Category
+ adict2['P'] = BJ.EbuildId.PackageId.Package
+ adict2['V'] = BJ.EbuildId.Version
+ adict2['R'] = BJ.EbuildId.PackageId.RepoId.Repo
+ adict2['title'] = "Setup: " + BJ.SetupId.Setup + "\n" + "Profile: " + BJ.SetupId.Profile + "\n"
+ BJU = BuildJobsUse.objects.filter(BuildJobId = BJ.BuildJobId)
+ if not BJU == []:
+ use_enable = []
+ use_disable = []
+ for BU in BJU:
+ if BU.Status:
+ use_enable.append(BU.UseId.Flag)
+ else:
+ use_disable.append(BU.UseId.Flag)
+ if not use_enable == []:
+ adict2['title'] = adict2['title'] + "Enable: "
+ for use in use_enable:
+ adict2['title'] = adict2['title'] + use + " "
+ adict2['title'] = adict2['title'] + "\n"
+ if not use_disable == []:
+ adict2['title'] = adict2['title'] + "Disable: "
+ for use in use_disable:
+ adict2['title'] = adict2['title'] + use + " "
+ adict2['title'] = adict2['title'] + "\n"
+ adict[BJ.BuildJobId] = adict2
+ TmpDict['BJ'] = adict
+ TmpDict['RM'] = BuildLogsRepomanQa.objects.order_by('-Id')[:Lines]
+ return render(request, 'pages/' + pagerequest + '/index.html', TmpDict)
+
+def categories(request):
+ pagerequest = 'packages'
+ TmpDict = default_TmpDict(pagerequest)
+ adict2 = {}
+ for CM in CategoriesMetadata.objects.filter(CategoryId__Active = True).order_by('CategoryId__Category'):
+ adict = {}
+ adict['CategoryId'] = CM.CategoryId.CategoryId
+ adict['Category'] = CM.CategoryId.Category
+ adict['Descriptions'] = CM.Descriptions
+ packages = []
+ for P in Packages.objects.filter(Active = True).filter(CategoryId_id = CM.CategoryId.CategoryId).order_by('Package'):
+ packages.append(P.Package + '\n')
+ adict['Packages'] = packages
+ adict2[CM.CategoryId.Category] = adict
+ TmpDict['CM_tmp'] = adict2
+ return render(request, 'pages/' + pagerequest + '/index.html', TmpDict)
+
+def packages(request, category_id):
+ pagerequest = 'packages'
+ TmpDict = default_TmpDict(pagerequest)
+ adict2 = {}
+ for PM in PackagesMetadata.objects.filter(PackageId__CategoryId_id = category_id).filter(PackageId__Active = True):
+ adict = {}
+ adict['PackageId'] = PM.PackageId.PackageId
+ adict['Package'] = PM.PackageId.Package
+ adict['Descriptions'] = PM.Descriptions
+ adict['Changlog'] =PM.Changlog
+ ebuilds = []
+ for E in Ebuilds.objects.filter(Active = True).filter(PackageId_id = PM.PackageId.PackageId):
+ ebuilds.append(E.Version + '::' + E.PackageId.RepoId.Repo + '\n')
+ adict['Ebuilds'] = ebuilds
+ adict2[PM.PackageId.Package] = adict
+ TmpDict['PM_tmp'] = adict2
+ TmpDict['C'] = get_object_or_404(Categories, CategoryId = category_id)
+ return render(request, 'pages/' + pagerequest + '/category/index.html', TmpDict)
+
+def ebuilds(request, package_id):
+ pagerequest = 'packages'
+ TmpDict = default_TmpDict(pagerequest)
+ TmpDict['EB_tmp'] = Ebuilds.objects.filter(PackageId_id = package_id)
+ TmpDict['P'] = get_object_or_404(Packages, PackageId = package_id)
+ return render(request, 'pages/' + pagerequest + '/ebuilds/index.html', TmpDict)
+
+def new(request):
+ pagerequest = 'new'
+ Lines = 20
adict = {}
TmpDict = default_TmpDict(pagerequest)
TmpDict['EM'] = EbuildsMetadata.objects.filter(Revision = '1.1').order_by('-Id')[:Lines]