diff options
author | Magnus Granberg <zorry@gentoo.org> | 2015-07-22 23:24:44 +0200 |
---|---|---|
committer | Magnus Granberg <zorry@gentoo.org> | 2015-07-22 23:24:44 +0200 |
commit | f66e4386ffe1b5f48a8f7986d6cc4371d7862b85 (patch) | |
tree | 1abc8528969a5a57719656d1312743879c129d5e /python | |
parent | include all repos in packages (diff) | |
download | tinderbox-cluster-www-f66e4386ffe1b5f48a8f7986d6cc4371d7862b85.tar.gz tinderbox-cluster-www-f66e4386ffe1b5f48a8f7986d6cc4371d7862b85.tar.bz2 tinderbox-cluster-www-f66e4386ffe1b5f48a8f7986d6cc4371d7862b85.zip |
add keywords to version view
Diffstat (limited to 'python')
-rw-r--r-- | python/tbc_www/models.py | 18 | ||||
-rw-r--r-- | python/tbc_www/views.py | 8 | ||||
-rw-r--r-- | python/templates/pages/packages/ebuilds/index.html | 20 |
3 files changed, 38 insertions, 8 deletions
diff --git a/python/tbc_www/models.py b/python/tbc_www/models.py index 3d284c2..9827583 100644 --- a/python/tbc_www/models.py +++ b/python/tbc_www/models.py @@ -150,3 +150,21 @@ class BuildJobsUse(models.Model): db_table = 'build_jobs_use' def __str__(self): return '%s %s %s %s' % (self.Id, self.BuildJobId, self.UseId, self.Status) + +class Keywords(models.Model): + KeywordId = models.IntegerField(primary_key=True, db_column='keyword_id') + Keyword = models.CharField(max_length=45, db_column='keyword') + class Meta: + db_table = 'keywords' + def __str__(self): + return '%s %s' % (self.KeywordId, self.Keyword) + +class EbuildsKeywords(models.Model): + Id = models.IntegerField(primary_key=True, db_column='id') + EbuildId = models.ForeignKey(Ebuilds, db_column='ebuild_id') + KeywordId = models.ForeignKey(Keywords, db_column='keyword_id') + Status = models.CharField(max_length=24, db_column='status') + class Meta: + db_table = 'ebuilds_keywords' + def __str__(self): + return '%s %s %s' % (self.EbuildId, self.KeywordId, self.Status) diff --git a/python/tbc_www/views.py b/python/tbc_www/views.py index a025cbf..84ff9e6 100644 --- a/python/tbc_www/views.py +++ b/python/tbc_www/views.py @@ -7,7 +7,7 @@ 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, Categories, CategoriesMetadata, Packages, PackagesMetadata, Ebuilds, \ - Repos + Repos, EbuildsKeywords import re def default_TmpDict(pagerequest): @@ -106,10 +106,10 @@ def packages(request, category_id): def ebuilds(request, package_id): pagerequest = 'packages' TmpDict = default_TmpDict(pagerequest) - P = get_object_or_404(Packages, PackageId = package_id) + P = get_object_or_404(PackagesMetadata, PackageId__PackageId = package_id) TmpDict['P'] = P - TmpDict['EM_tmp'] = EbuildsMetadata.objects.filter(EbuildId__Active = True).filter(EbuildId__PackageId__Package = P.Package) - print(TmpDict) + TmpDict['EM_tmp'] = EbuildsMetadata.objects.filter(EbuildId__Active = True).filter(EbuildId__PackageId__Package = P.PackageId.Package) + TmpDict['EK_tmp'] = EbuildsKeywords.objects.filter(EbuildId__Active = True).filter(EbuildId__PackageId__Package = P.PackageId.Package) return render(request, 'pages/' + pagerequest + '/ebuilds/index.html', TmpDict) def new(request): diff --git a/python/templates/pages/packages/ebuilds/index.html b/python/templates/pages/packages/ebuilds/index.html index 73f45f2..1e034d4 100644 --- a/python/templates/pages/packages/ebuilds/index.html +++ b/python/templates/pages/packages/ebuilds/index.html @@ -1,14 +1,26 @@ {% extends "layout/base.html" %} {% block content %} <div class="row"> - <div class="col-xs-12 col-md-6"> - <h2>{{ P.CategoryId.Category }}/{{ P.Package }}</h2> + <div class="col-xs-12 col-md-9"> + <h2>{{ P.PackageId.CategoryId.Category }}/{{ P.PackageId.Package }}</h2> + <p>Changlog</p> + <p>{{ P.Changlog|linebreaksbr }}</p> <table class="table table-striped frontpage-table"> {% for E in EM_tmp %} <tr> <td class="frontpage-table-package-atom"> - <a href="/ebuild/{{ E.EbuildId.EbuildId }}/" title="{{ P.CategoryId.Category }}/{{ P.Package }}-{{ E.EbuildId.Version }}::{{ E.EbuildId.PackageId.RepoId.Repo }}">{{ P.Package }}-{{ E.EbuildId.Version }}::{{ E.EbuildId.PackageId.RepoId.Repo }}</a></td> - <td><p></p></td> + <a href="/ebuild/{{ E.EbuildId.EbuildId }}/" title="{{ P.PackageId.CategoryId.Category }}/{{ P.PackageId.Package }}-{{ E.EbuildId.Version }}::{{ E.EbuildId.PackageId.RepoId.Repo }}">{{ P.PackageId.Package }}-{{ E.EbuildId.Version }}::{{ E.EbuildId.PackageId.RepoId.Repo }}</a></td> + <td> + <td class="text-right"> + {% for K in EK_tmp %} + {% if K.EbuildId.EbuildId == E.EbuildId.EbuildId and K.KeywordId.Keyword != '*' %} + {% if K.Status == 'Stable' %}<span class="label label-success">{{ K.KeywordId.Keyword }}</span>{% endif %} + {% if K.Status == 'Unstable' %}<span class="label label-warning">{{ K.KeywordId.Keyword }}</span>{% endif %} + {% if K.Status == 'Negative' %}{{ K.KeywordId.Keyword }}{% endif %} + {% endif %} + {% endfor %} + </td> + </td> </tr> {% endfor %} </table> |