* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-06-27 22:52 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-06-27 22:52 UTC (permalink / raw
To: gentoo-commits
commit: 024d77654ecb1749c2e7eb16dc58d77db711ff47
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Wed Jun 27 19:10:05 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Wed Jun 27 19:10:05 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=024d7765
Add base view for packages
---
gpackages/apps/packages/managers.py | 3 ++
gpackages/apps/packages/urls.py | 4 ++-
gpackages/apps/packages/views.py | 12 ++++++-
gpackages/templates/packages.html | 60 +++++++++++++++++++++++++++++++++++
4 files changed, 77 insertions(+), 2 deletions(-)
diff --git a/gpackages/apps/packages/managers.py b/gpackages/apps/packages/managers.py
index 8cc015c..557cd48 100644
--- a/gpackages/apps/packages/managers.py
+++ b/gpackages/apps/packages/managers.py
@@ -81,6 +81,9 @@ class EbuildMixin(object):#{{{
'revision': ebuild.revision })
return super(EbuildMixin, self).get(*args, **kwargs)#}}}
+ def all_by_numbers(self):
+ return super(EbuildMixin, self).order_by('version', 'revision')
+
class HerdsMixin(object):#{{{
def filter(self, *args, **kwargs):
diff --git a/gpackages/apps/packages/urls.py b/gpackages/apps/packages/urls.py
index 33af35d..569417e 100644
--- a/gpackages/apps/packages/urls.py
+++ b/gpackages/apps/packages/urls.py
@@ -1,6 +1,7 @@
from django.conf.urls import patterns, include, url
from views import CategoriesListView, HerdsListView, MaintainersListView, \
- RepositoriesListView, LicenseGroupsView , EbuildsListView
+ RepositoriesListView, LicenseGroupsView , EbuildsListView, \
+ PackagesListsView
urlpatterns = patterns('',
url(r'^categories/$', CategoriesListView.as_view(), name = 'categories'),
@@ -9,4 +10,5 @@ urlpatterns = patterns('',
url(r'^repositories/$', RepositoriesListView.as_view(), name = 'repositories'),
url(r'^license-groups/$', LicenseGroupsView.as_view(), name = 'license_groups'),
url(r'^$', EbuildsListView.as_view(), name = 'ebuilds'),
+ url(r'^packages/$', PackagesListsView.as_view(), name = 'packages'),
)
diff --git a/gpackages/apps/packages/views.py b/gpackages/apps/packages/views.py
index 93a1abd..6f73fdd 100644
--- a/gpackages/apps/packages/views.py
+++ b/gpackages/apps/packages/views.py
@@ -1,6 +1,7 @@
from generic.views import ContextListView, ContextTemplateView
from models import CategoryModel, HerdsModel, MaintainerModel, \
- RepositoryModel, LicenseGroupModel, EbuildModel
+ RepositoryModel, LicenseGroupModel, EbuildModel, \
+ PackageModel
class CategoriesListView(ContextListView):
extra_context = {'page_name': 'Categories',}
@@ -42,3 +43,12 @@ class EbuildsListView(ContextListView):
select_related('package',
'package__virtual_package',
'package__virtual_package__category')
+
+class PackagesListsView(ContextListView):
+ paginate_by = 40
+ extra_context = {'page_name': 'Packages',}
+ template_name = 'packages.html'
+ context_object_name = 'packages'
+ queryset = PackageModel.objects.all(). \
+ select_related('virtual_package', 'virtual_package__category')
+ #prefetch_related('ebuildmodel_set')
diff --git a/gpackages/templates/packages.html b/gpackages/templates/packages.html
new file mode 100644
index 0000000..adead16
--- /dev/null
+++ b/gpackages/templates/packages.html
@@ -0,0 +1,60 @@
+{% extends "base.html" %}
+
+{% block content %}
+{% for package in packages %}
+ <div class="well package-well">
+ <div class="package-name">
+ <span>{{ package.cp }}</span>
+ <span class="package_update_datetime">{{ package.updated_datetime }}</span>
+ </div>
+ {% if package.description %}
+ <div style="padding-bottom: 10px; margin 10px;">{{ package.description }}</div>
+ {% endif %}
+ <table class="keywords table table-bordered table-condensed">
+ <colgroup>
+ <col class="span2">
+ <col class="span1">
+ <col class="span1">
+ <col class="span1">
+ <col class="span1">
+ <col class="span1">
+ <col class="span1">
+ <col class="span1">
+ <col class="span1">
+ <col class="span1">
+ </colgroup>
+ <thead>
+ <tr class="">
+ <th class=""></th>
+ <th class="">alpha</th>
+ <th class="">amd64</th>
+ <th class="">arm</th>
+ <th class="">hppa</th>
+ <th class="">ia64</th>
+ <th class="">ppc</th>
+ <th class="">ppc64</th>
+ <th class="">sparc</th>
+ <th class="">x86</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for ebuild in package.ebuildmodel_set.all_by_numbers %}
+ <tr>
+ <td class="ebuild">{{ ebuild.fullversion }}</td>
+ <td class="blank"></td>
+ <td class="unstable">~</td>
+ <td class="blank"></td>
+ <td class="blank"></td>
+ <td class="blank"></td>
+ <td class="blank"></td>
+ <td class="blank"></td>
+ <td class="blank"></td>
+ <td class="unstable">~</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+ </div>
+{% endfor %}
+{% include 'paginator.html' %}
+{% endblock content %}
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-06-28 23:59 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-06-28 23:59 UTC (permalink / raw
To: gentoo-commits
commit: da9ac5b7a7b636fdf67a528386e676ee95c10e9a
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Thu Jun 28 22:45:14 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Thu Jun 28 22:45:14 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=da9ac5b7
Add PackageDetailView
---
gpackages/apps/packages/models.py | 13 ++++++++
gpackages/apps/packages/urls.py | 7 ++++-
gpackages/apps/packages/views.py | 50 +++++++++++++++++++++++++++++-
gpackages/templates/package.html | 5 +++
gpackages/templates/package_object.html | 12 +++++++
gpackages/templates/packages.html | 12 +------
6 files changed, 86 insertions(+), 13 deletions(-)
diff --git a/gpackages/apps/packages/models.py b/gpackages/apps/packages/models.py
index aa7bd65..1e50175 100644
--- a/gpackages/apps/packages/models.py
+++ b/gpackages/apps/packages/models.py
@@ -316,6 +316,19 @@ class PackageModel(AbstractDateTimeModel):
for ebuild in self.ebuilds:
l.extend(ebuild.get_ebuilds_and_keywords(arch_list))
return l
+
+ @models.permalink
+ def get_absolute_url_by_pk(self):
+ return ('package',(), {'pk': self.pk})
+
+ @models.permalink
+ def get_absolute_url(self):
+ # It coold been in many repositories
+ kwargs = { 'category': self.virtual_package.category.category,
+ 'name': self.virtual_package.name }
+ if self.repository.name != 'gentoo':
+ kwargs['repository'] = self.repository.name
+ return ('package',(), kwargs )
class Meta:
unique_together = ('virtual_package', 'repository')
diff --git a/gpackages/apps/packages/urls.py b/gpackages/apps/packages/urls.py
index 569417e..3744802 100644
--- a/gpackages/apps/packages/urls.py
+++ b/gpackages/apps/packages/urls.py
@@ -1,7 +1,7 @@
from django.conf.urls import patterns, include, url
from views import CategoriesListView, HerdsListView, MaintainersListView, \
RepositoriesListView, LicenseGroupsView , EbuildsListView, \
- PackagesListsView
+ PackagesListsView, PackageDetailView
urlpatterns = patterns('',
url(r'^categories/$', CategoriesListView.as_view(), name = 'categories'),
@@ -11,4 +11,9 @@ urlpatterns = patterns('',
url(r'^license-groups/$', LicenseGroupsView.as_view(), name = 'license_groups'),
url(r'^$', EbuildsListView.as_view(), name = 'ebuilds'),
url(r'^packages/$', PackagesListsView.as_view(), name = 'packages'),
+
+ # In Future I will write my onw URL Resolver !!!
+ #url(r'^package/(?:(?P<pk>\d+)|(?P<category>[^/]+)/(?P<name>[^/]+))/$', PackageDetailView.as_view(), name = 'package'),
+ url(r'^package/(?P<pk>\d+)/$', PackageDetailView.as_view(), name = 'package'),
+ url(r'^package/(?P<category>[^/]+)/(?P<name>[^/:]+)(::(?P<repository>[^/]+))?/$', PackageDetailView.as_view(), name = 'package'),
)
diff --git a/gpackages/apps/packages/views.py b/gpackages/apps/packages/views.py
index 4639555..98672d4 100644
--- a/gpackages/apps/packages/views.py
+++ b/gpackages/apps/packages/views.py
@@ -1,8 +1,11 @@
-from generic.views import ContextListView, ContextTemplateView
+from django.views.generic import DetailView
+from generic.views import ContextListView, ContextTemplateView, ContextView
from models import CategoryModel, HerdsModel, MaintainerModel, \
RepositoryModel, LicenseGroupModel, EbuildModel, \
PackageModel
+from django.shortcuts import get_object_or_404
+
class CategoriesListView(ContextListView):
extra_context = {'page_name': 'Categories',}
template_name = 'categories.html'
@@ -52,5 +55,48 @@ class PackagesListsView(ContextListView):
template_name = 'packages.html'
context_object_name = 'packages'
queryset = PackageModel.objects.all(). \
- select_related('virtual_package', 'virtual_package__category'). \
+ select_related('virtual_package',
+ 'virtual_package__category',
+ 'repository'). \
+ defer('repository__description',
+ 'repository__owner_name',
+ 'repository__owner_email',
+ 'repository__homepage',
+ 'repository__official',
+ 'repository__quality',
+ 'changelog'). \
prefetch_keywords(arches)
+
+class PackageDetailView(ContextView, DetailView):
+ arches = ['alpha', 'amd64', 'arm', 'hppa', 'ia64', 'ppc', 'ppc64', 'sparc', 'x86']
+ template_name = 'package.html'
+ extra_context = {'page_name': 'Package', 'arches': arches}
+ context_object_name = 'package'
+ queryset = PackageModel.objects.all(). \
+ select_related('virtual_package',
+ 'virtual_package__category',
+ 'repository'). \
+ defer('repository__description',
+ 'repository__owner_name',
+ 'repository__owner_email',
+ 'repository__homepage',
+ 'repository__official',
+ 'repository__quality',
+ 'changelog'). \
+ prefetch_keywords(arches)
+
+ def get_object(self, queryset = None):
+ pk = self.kwargs.get('pk')
+ if pk is not None:
+ return super(PackageDetailView, self).get_object(queryset)
+ if queryset is None:
+ queryset = self.get_queryset()
+
+ name, category = self.kwargs.get('name'), self.kwargs.get('category')
+ repository = self.kwargs.get('repository')
+ if repository is None:
+ repository = 'gentoo'
+ obj = get_object_or_404(queryset, name = name,
+ category = category,
+ repository__name = repository)
+ return obj
diff --git a/gpackages/templates/package.html b/gpackages/templates/package.html
new file mode 100644
index 0000000..9023001
--- /dev/null
+++ b/gpackages/templates/package.html
@@ -0,0 +1,5 @@
+{% extends "base.html" %}
+
+{% block content %}
+ {% include 'package_object.html' %}
+{% endblock content %}
diff --git a/gpackages/templates/package_object.html b/gpackages/templates/package_object.html
new file mode 100644
index 0000000..d713d4a
--- /dev/null
+++ b/gpackages/templates/package_object.html
@@ -0,0 +1,12 @@
+{% load url from future %}
+{% load packages %}
+<div class="well package-well">
+ <div class="package-name">
+ <span><a href="{{ package.get_absolute_url }}">{{ package.cp }}</a>:: {{ package.repository.name }}</span>
+ <span class="package_update_datetime">{{ package.updated_datetime }}</span>
+ </div>
+ {% if package.description %}
+ <div style="padding-bottom: 10px; margin 10px;">{{ package.description }}</div>
+ {% endif %}
+ {% render_keywords_table package arches %}
+</div>
diff --git a/gpackages/templates/packages.html b/gpackages/templates/packages.html
index ec6d22a..f7ac01a 100644
--- a/gpackages/templates/packages.html
+++ b/gpackages/templates/packages.html
@@ -1,18 +1,10 @@
{% extends "base.html" %}
+{% load url from future %}
{% load packages %}
{% block content %}
{% for package in packages %}
- <div class="well package-well">
- <div class="package-name">
- <span>{{ package.cp }}</span>
- <span class="package_update_datetime">{{ package.updated_datetime }}</span>
- </div>
- {% if package.description %}
- <div style="padding-bottom: 10px; margin 10px;">{{ package.description }}</div>
- {% endif %}
- {% render_keywords_table package arches %}
- </div>
+ {% include 'package_object.html' %}
{% endfor %}
{% include 'paginator.html' %}
{% endblock content %}
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-06-29 19:25 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-06-29 19:25 UTC (permalink / raw
To: gentoo-commits
commit: da1ad22983b481f3da07752ea18b1337955fd5b9
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Fri Jun 29 19:25:28 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Fri Jun 29 19:25:28 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=da1ad229
Add dynamic packages filter
---
gpackages/apps/packages/urls.py | 3 +-
gpackages/apps/packages/views.py | 68 ++++++++++++++++++++++++++++++++-
gpackages/templates/categories.html | 3 +-
gpackages/templates/herds.html | 4 +-
gpackages/templates/maintainers.html | 3 +-
gpackages/templates/repositories.html | 3 +-
6 files changed, 77 insertions(+), 7 deletions(-)
diff --git a/gpackages/apps/packages/urls.py b/gpackages/apps/packages/urls.py
index ffb16ca..f597026 100644
--- a/gpackages/apps/packages/urls.py
+++ b/gpackages/apps/packages/urls.py
@@ -10,7 +10,8 @@ urlpatterns = patterns('',
url(r'^repositories/$', RepositoriesListView.as_view(), name = 'repositories'),
url(r'^license-groups/$', LicenseGroupsView.as_view(), name = 'license_groups'),
url(r'^$', EbuildsListView.as_view(), name = 'ebuilds'),
- url(r'^packages/$', PackagesListsView.as_view(), name = 'packages'),
+ url(r'^packages/(?:category/(?P<category>[^/]+)/)?(?:repo/(?P<repo>[^/]*)/)?(?:herd/(?P<herd>[^/]+)/)?(?:maintainer/(?P<maintainer_pk>[^/]+)/)?(?:order/(?P<order>[a-z]*)/)?(?P<rev>rev/)?$',
+ PackagesListsView.as_view(), name = 'packages'),
# In Future I will write my onw URL Resolver !!!
#url(r'^package/(?:(?P<pk>\d+)|(?P<category>[^/]+)/(?P<name>[^/]+))/$', PackageDetailView.as_view(), name = 'package'),
diff --git a/gpackages/apps/packages/views.py b/gpackages/apps/packages/views.py
index 2ec2758..2c75ed6 100644
--- a/gpackages/apps/packages/views.py
+++ b/gpackages/apps/packages/views.py
@@ -48,7 +48,53 @@ class EbuildsListView(ContextListView):
'package__virtual_package',
'package__virtual_package__category').prefetch_keywords(arches)
+# there is another dynamic filter for django, and it maybe better
+# but it is too big and i need just a litle of its functionly
+# but if this code have to be grove maybe i replace it to django-filter
+# application or another.
+def dynamic_filter(filter_set, allowed):
+ result = {}
+ for k in allowed.iterkeys():
+ if k in filter_set:
+ result[allowed[k]] = filter_set[k]
+ return result
+
+def exclude_blank(res_dict):
+ result = {}
+ for k in res_dict.iterkeys():
+ if res_dict[k]:
+ result[k] = res_dict[k]
+ return result
+
+def dynamic_order(args_list, allowed_list, reverse = None):
+ order = allowed_list.get(None)
+ if reverse is None:
+ reverse = args_list.get('reverse', False)
+ if args_list.get('order') in allowed_list:
+ order = allowed_list.get(args_list.get('order'))
+
+ if order == '?':
+ return order
+
+ if reverse and order[0] != '-':
+ order = '-' + order
+ elif reverse:
+ order = order[1:]
+ return order
+
class PackagesListsView(ContextListView):
+ allowed_filter = { 'category':'virtual_package__category__category',
+ 'repo':'repository__name',
+ 'herd':'herds__name',
+ 'maintainer_pk': 'maintainers__pk',
+ 'license': 'licenses__name'
+ }
+
+ allowed_order = { 'create': 'created_datetime',
+ 'update': 'updated_datetime',
+ 'rand':'?', # it slow
+ None: '-updated_datetime'
+ }
arches = ['alpha', 'amd64', 'arm', 'hppa', 'ia64', 'ppc', 'ppc64', 'sparc', 'x86']
paginate_by = 40
extra_context = {'page_name': 'Packages', 'arches': arches}
@@ -62,12 +108,32 @@ class PackagesListsView(ContextListView):
#INNER JOIN packages_virtualpackagemodel vp
#ON( `vp`.id = t.virtual_package_id) INNER JOIN `packages_categorymodel` cp
#ON (vp.category_id = cp.id);
- queryset = PackageModel.objects.all(). \
+ base_queryset = PackageModel.objects.all(). \
select_related('virtual_package',
'virtual_package__category'). \
prefetch_related('repository'). \
prefetch_keywords(arches)
+ def get_queryset(self):
+ qs = dynamic_filter(exclude_blank(self.request.GET),
+ self.allowed_filter)
+ qs.update( dynamic_filter(exclude_blank(self.kwargs),
+ self.allowed_filter) )
+
+ if self.kwargs.get('rev') is None:
+ reverse = bool(self.request.GET.get('rev',False))
+ else:
+ reverse = bool(self.kwargs.get('rev',False))
+
+ if 'order' in self.request.GET:
+ order = dynamic_order(self.request.GET, self.allowed_order,reverse)
+ else:
+ order = dynamic_order(self.kwargs, self.allowed_order, reverse)
+ if self.kwargs.get('order') not in self.allowed_order:
+ raise Http404('no such order')
+
+ return self.base_queryset.filter(**qs).order_by(order)
+
class PackageDetailView(ContextView, DetailView):
arches = ['alpha', 'amd64', 'arm', 'hppa', 'ia64', 'ppc', 'ppc64', 'sparc', 'x86']
template_name = 'package.html'
diff --git a/gpackages/templates/categories.html b/gpackages/templates/categories.html
index 4163e90..52cfd1f 100644
--- a/gpackages/templates/categories.html
+++ b/gpackages/templates/categories.html
@@ -1,4 +1,5 @@
{% extends "base.html" %}
+{% load url from future %}
{% block content %}
@@ -16,7 +17,7 @@
<tbody>
{% for category in categories %}
<tr>
- <td class="nowrap"><a href="#">{{ category.category }}</a></td>
+ <td class="nowrap"><a href="{% url 'packages' category=category.category %}">{{ category.category }}</a></td>
<td>{{ category.description|default_if_none:"" }}</td>
</tr>
{% endfor %}
diff --git a/gpackages/templates/herds.html b/gpackages/templates/herds.html
index 5252576..b767967 100644
--- a/gpackages/templates/herds.html
+++ b/gpackages/templates/herds.html
@@ -1,6 +1,6 @@
{% extends "base.html" %}
{% load packages %}
-
+{% load url from future %}
{% block content %}
<table class='table table-striped table-hover'>
@@ -19,7 +19,7 @@
<tbody>
{% for herd in herds %}
<tr>
- <td class="nowrap"><a href="#">{{ herd.name }}</a></td>
+ <td class="nowrap"><a href="{% url 'packages' herd=herd.name %}">{{ herd.name }}</a></td>
<!-- email should be obfuscated -->
<td class="nowrap"><a href="{{ 'mailto:'|add:herd.email|obfuscate }}">{{ herd.email|obfuscate }}</a></td>
<td>{{ herd.description|default_if_none:"" }}</td>
diff --git a/gpackages/templates/maintainers.html b/gpackages/templates/maintainers.html
index 5646c99..ecd087e 100644
--- a/gpackages/templates/maintainers.html
+++ b/gpackages/templates/maintainers.html
@@ -1,5 +1,6 @@
{% extends "base.html" %}
{% load packages %}
+{% load url from future %}
{% block content %}
@@ -17,7 +18,7 @@
<tbody>
{% for maintainer in maintainers %}
<tr>
- <td class="nowrap"><a href="#">{{ maintainer.name|default:"Not represented" }}</a></td>
+ <td class="nowrap"><a href="{% url 'packages' maintainer_pk=maintainer.pk %}">{{ maintainer.name|default:"Not represented" }}</a></td>
<!-- email should be obfuscated -->
<td class="nowrap"><a href="{{ 'mailto:'|add:maintainer.email|obfuscate }}">{{ maintainer.email|obfuscate }}</a></td>
</tr>
diff --git a/gpackages/templates/repositories.html b/gpackages/templates/repositories.html
index 0fdb42a..591141f 100644
--- a/gpackages/templates/repositories.html
+++ b/gpackages/templates/repositories.html
@@ -1,4 +1,5 @@
{% extends "base.html" %}
+{% load url from future %}
{% block content %}
@@ -18,7 +19,7 @@
<tbody>
{% for repository in repositories %}
<tr>
- <td class="nowrap"><a href="#">{{ repository.name }}</a></td>
+ <td class="nowrap"><a href="{% url 'packages' repo=repository.name %}">{{ repository.name }}</a></td>
<td>{{ repository.description|default_if_none:"" }}</td>
<td>{{ repository.updated_datetime|date:"d m Y H:i:s" }}</td>
</tr>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-06-30 0:22 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-06-30 0:22 UTC (permalink / raw
To: gentoo-commits
commit: 920d1c111d7331be349cde41798c715e520799a5
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Fri Jun 29 23:22:29 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Fri Jun 29 23:22:29 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=920d1c11
Add simple ebuild view
---
gpackages/apps/packages/urls.py | 3 ++-
gpackages/apps/packages/views.py | 10 ++++++++++
gpackages/templates/ebuild.html | 5 +++++
gpackages/templates/ebuild_object.html | 9 +++++++++
gpackages/templates/ebuilds.html | 9 +--------
gpackages/templates/keywords_table.html | 3 ++-
6 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/gpackages/apps/packages/urls.py b/gpackages/apps/packages/urls.py
index 045a5ea..0dccc06 100644
--- a/gpackages/apps/packages/urls.py
+++ b/gpackages/apps/packages/urls.py
@@ -1,7 +1,7 @@
from django.conf.urls import patterns, include, url
from views import CategoriesListView, HerdsListView, MaintainersListView, \
RepositoriesListView, LicenseGroupsView , EbuildsListView, \
- PackagesListsView, PackageDetailView
+ PackagesListsView, PackageDetailView, EbuildDetailView
urlpatterns = patterns('',
url(r'^categories/$', CategoriesListView.as_view(), name = 'categories'),
@@ -10,6 +10,7 @@ urlpatterns = patterns('',
url(r'^repositories/$', RepositoriesListView.as_view(), name = 'repositories'),
url(r'^license-groups/$', LicenseGroupsView.as_view(), name = 'license_groups'),
url(r'^$', EbuildsListView.as_view(), name = 'ebuilds'),
+ url(r'^ebuild/(?P<pk>\d+)/$', EbuildDetailView.as_view(), name = 'ebuild'),
url(r'^packages/{0}$'.format(PackagesListsView.get_url_part()), PackagesListsView.as_view(), name = 'packages'),
# In Future I will write my onw URL Resolver !!!
diff --git a/gpackages/apps/packages/views.py b/gpackages/apps/packages/views.py
index d04acd3..45e1e55 100644
--- a/gpackages/apps/packages/views.py
+++ b/gpackages/apps/packages/views.py
@@ -51,6 +51,16 @@ class EbuildsListView(ContextListView):
'package__virtual_package__category'). \
prefetch_keywords(arches)
+class EbuildDetailView(ContextView, DetailView):
+ template_name = 'ebuild.html'
+ extra_context = {'page_name': 'Ebuild', 'arches': arches}
+ context_object_name = 'ebuild'
+ queryset = EbuildModel.objects.all(). \
+ select_related('package',
+ 'package__virtual_package',
+ 'package__virtual_package__category'). \
+ prefetch_keywords(arches)
+
class PackagesListsView(MultipleFilterListViewMixin, ContextListView):
allowed_filter = { 'category':'virtual_package__category__category',
'repo':'repository__name',
diff --git a/gpackages/templates/ebuild.html b/gpackages/templates/ebuild.html
new file mode 100644
index 0000000..2b7198a
--- /dev/null
+++ b/gpackages/templates/ebuild.html
@@ -0,0 +1,5 @@
+{% extends "base.html" %}
+
+{% block content %}
+{% include 'ebuild_object.html' %}
+{% endblock content %}
diff --git a/gpackages/templates/ebuild_object.html b/gpackages/templates/ebuild_object.html
new file mode 100644
index 0000000..f75b427
--- /dev/null
+++ b/gpackages/templates/ebuild_object.html
@@ -0,0 +1,9 @@
+{% load packages %}
+<div class="well package-well">
+ <div class="package-name">
+ <span>{{ ebuild.cpv }}</span>
+ <span class="package_update_datetime">{{ ebuild.updated_datetime }}</span>
+ </div>
+ <div style="padding-bottom: 10px; margin 10px;">{{ ebuild.description }}</div>
+ {% render_keywords_table ebuild arches %}
+</div>
diff --git a/gpackages/templates/ebuilds.html b/gpackages/templates/ebuilds.html
index 94e1ecd..aa28c09 100644
--- a/gpackages/templates/ebuilds.html
+++ b/gpackages/templates/ebuilds.html
@@ -3,14 +3,7 @@
{% block content %}
{% for ebuild in ebuilds %}
- <div class="well package-well">
- <div class="package-name">
- <span>{{ ebuild.cpv }}</span>
- <span class="package_update_datetime">{{ ebuild.updated_datetime }}</span>
- </div>
- <div style="padding-bottom: 10px; margin 10px;">{{ ebuild.description }}</div>
- {% render_keywords_table ebuild arches %}
- </div>
+ {% include 'ebuild_object.html' %}
{% endfor %}
{% include 'paginator.html' %}
{% endblock content %}
diff --git a/gpackages/templates/keywords_table.html b/gpackages/templates/keywords_table.html
index 38cba68..dcef1a2 100644
--- a/gpackages/templates/keywords_table.html
+++ b/gpackages/templates/keywords_table.html
@@ -1,3 +1,4 @@
+{% load url from future %}
<table class="keywords table table-bordered table-condensed">
<colgroup>
<col class="span2">
@@ -17,7 +18,7 @@
<tbody>
{% for ebuild in ebuilds %}
<tr>
- <td class="ebuild">{{ ebuild.fullversion }}</td>
+ <td class="ebuild"><a href="{% url 'ebuild' pk=ebuild.pk %}">{{ ebuild.fullversion }}</a></td>
{% for keyword in ebuild.keywords %}
<td class="{{ keyword.status_class }}">{{ keyword.status_repr }}</td>
{% endfor %}
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-06-30 21:02 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-06-30 21:02 UTC (permalink / raw
To: gentoo-commits
commit: e7b70215e10380d489b9532024edfd578826fd83
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Sat Jun 30 19:40:19 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Sat Jun 30 19:40:19 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=e7b70215
Add global use flags view
---
gpackages/apps/packages/models.py | 3 +++
gpackages/apps/packages/urls.py | 4 +++-
gpackages/apps/packages/views.py | 8 +++++++-
gpackages/templates/base.html | 1 +
gpackages/templates/global_use.html | 27 +++++++++++++++++++++++++++
5 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/gpackages/apps/packages/models.py b/gpackages/apps/packages/models.py
index 1e50175..29a2d64 100644
--- a/gpackages/apps/packages/models.py
+++ b/gpackages/apps/packages/models.py
@@ -341,6 +341,9 @@ class UseFlagModel(models.Model):
def __unicode__(self):
return self.name
+ class Meta:
+ ordering = ('name',)
+
class UseFlagDescriptionModel(models.Model):
use_flag = models.ForeignKey(UseFlagModel, db_index = True)
package = models.ForeignKey(VirtualPackageModel)
diff --git a/gpackages/apps/packages/urls.py b/gpackages/apps/packages/urls.py
index 0dccc06..4d47a08 100644
--- a/gpackages/apps/packages/urls.py
+++ b/gpackages/apps/packages/urls.py
@@ -1,11 +1,13 @@
from django.conf.urls import patterns, include, url
from views import CategoriesListView, HerdsListView, MaintainersListView, \
RepositoriesListView, LicenseGroupsView , EbuildsListView, \
- PackagesListsView, PackageDetailView, EbuildDetailView
+ PackagesListsView, PackageDetailView, EbuildDetailView, \
+ GlobalUseListView
urlpatterns = patterns('',
url(r'^categories/$', CategoriesListView.as_view(), name = 'categories'),
url(r'^herds/$', HerdsListView.as_view(), name = 'herds'),
+ url(r'^use/$', GlobalUseListView.as_view(), name = 'global_uses'),
url(r'^maintainers/$', MaintainersListView.as_view(), name = 'maintainers'),
url(r'^repositories/$', RepositoriesListView.as_view(), name = 'repositories'),
url(r'^license-groups/$', LicenseGroupsView.as_view(), name = 'license_groups'),
diff --git a/gpackages/apps/packages/views.py b/gpackages/apps/packages/views.py
index 45e1e55..97e54d6 100644
--- a/gpackages/apps/packages/views.py
+++ b/gpackages/apps/packages/views.py
@@ -3,7 +3,7 @@ from generic.views import ContextListView, ContextTemplateView, ContextView, \
MultipleFilterListViewMixin
from models import CategoryModel, HerdsModel, MaintainerModel, \
RepositoryModel, LicenseGroupModel, EbuildModel, \
- PackageModel
+ PackageModel, UseFlagModel
from django.shortcuts import get_object_or_404
@@ -119,3 +119,9 @@ class PackageDetailView(ContextView, DetailView):
category = category,
repository__name = repository)
return obj
+
+class GlobalUseListView(ContextListView):
+ extra_context = {'page_name': 'Global Use', }
+ template_name = 'global_use.html'
+ context_object_name = 'uses'
+ queryset = UseFlagModel.objects.exclude(description = '')
diff --git a/gpackages/templates/base.html b/gpackages/templates/base.html
index a5998d0..172dd9d 100644
--- a/gpackages/templates/base.html
+++ b/gpackages/templates/base.html
@@ -138,6 +138,7 @@ Text
{% active_link 'herds' 'Herds' %}
{% active_link 'repositories' 'Repositories' %}
{% active_link 'license_groups' 'License Groups' %}
+ {% active_link 'global_uses' 'Global Use Flags' %}
</ul>
</div>
</div> <!-- span3 --><!--}}}-->
diff --git a/gpackages/templates/global_use.html b/gpackages/templates/global_use.html
new file mode 100644
index 0000000..266816f
--- /dev/null
+++ b/gpackages/templates/global_use.html
@@ -0,0 +1,27 @@
+{% extends "base.html" %}
+{% load url from future %}
+
+{% block content %}
+
+<table class='table table-striped table-hover'>
+ <colgroup>
+ <col class="span1" >
+ <col class="span9" >
+ </colgroup>
+ <thead>
+ <tr>
+ <th>Use flag</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for use in uses %}
+ <tr>
+ <td class="nowrap"><a href="#">{{ use.name }}</a></td>
+ <td>{{ use.description }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+</table>
+
+{% endblock content %}
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-06-30 21:02 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-06-30 21:02 UTC (permalink / raw
To: gentoo-commits
commit: 57537f51cd6d5eb9a58cb7b030e57183449bea0b
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Sat Jun 30 20:51:52 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Sat Jun 30 20:51:52 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=57537f51
Add filtering packages by use flag
---
gpackages/apps/packages/views.py | 5 +++--
gpackages/templates/global_use.html | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/gpackages/apps/packages/views.py b/gpackages/apps/packages/views.py
index c77c46e..81bb609 100644
--- a/gpackages/apps/packages/views.py
+++ b/gpackages/apps/packages/views.py
@@ -66,10 +66,11 @@ class PackagesListsView(MultipleFilterListViewMixin, ContextListView):
'repo':'repository__name',
'herd':'herds__name',
'maintainer': 'maintainers__pk',
- 'license': 'ebuildmodel__licenses__name'
+ 'license': 'ebuildmodel__licenses__name',
+ 'use': 'ebuildmodel__use_flags__name'
}
- m2m_filter = set(['herd', 'maintainer', 'license'])
+ m2m_filter = set(['herd', 'maintainer', 'license', 'use'])
allowed_order = { 'create': 'created_datetime',
'update': 'updated_datetime',
diff --git a/gpackages/templates/global_use.html b/gpackages/templates/global_use.html
index 266816f..fce42fb 100644
--- a/gpackages/templates/global_use.html
+++ b/gpackages/templates/global_use.html
@@ -17,7 +17,7 @@
<tbody>
{% for use in uses %}
<tr>
- <td class="nowrap"><a href="#">{{ use.name }}</a></td>
+ <td class="nowrap"><a href="{% url 'packages' use=use.name %}">{{ use.name }}</a></td>
<td>{{ use.description }}</td>
</tr>
{% endfor %}
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-07-02 22:25 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-07-02 22:25 UTC (permalink / raw
To: gentoo-commits
commit: f69717f90b90d5a2be3ec2389771e9726ae0beb0
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Mon Jul 2 18:10:08 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Mon Jul 2 18:10:08 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=f69717f9
More cool links
---
gpackages/apps/packages/models.py | 53 ++++++++++++++---
gpackages/apps/packages/urls.py | 3 +-
gpackages/apps/packages/utils.py | 96 +++++++++++++++++++++++++++++++
gpackages/apps/packages/validators.py | 8 +++
gpackages/apps/packages/views.py | 29 ++++++++-
gpackages/templates/keywords_table.html | 3 +-
6 files changed, 176 insertions(+), 16 deletions(-)
diff --git a/gpackages/apps/packages/models.py b/gpackages/apps/packages/models.py
index 29a2d64..624afc0 100644
--- a/gpackages/apps/packages/models.py
+++ b/gpackages/apps/packages/models.py
@@ -6,11 +6,8 @@ from package_info.generic import get_from_kwargs_and_del
from package_info.repo_info import REPOS_TYPE
# relative
from .keywords import KeywordRepr
-
-from django.core.validators import URLValidator, validate_email
-from django.core.exceptions import ValidationError
-
-validate_url = URLValidator()
+from utils import get_link
+from .validators import validate_url, validate_email
class AbstractDateTimeModel(models.Model):
@@ -228,10 +225,17 @@ class VirtualPackageModel(models.Model):
objects = managers.VirtualPackageManager()
+ #forum_template = /
+ #"http://forums.gentoo.org/search.php?search_terms=all&show_results=topics&search_keywords=%s&mode=results"
+
@property
def cp(self):
return "%s/%s" % (unicode(self.category), self.name)
+ @property
+ def forum_link(self):
+ return self.forum_template % self.name
+
def __unicode__(self):
return unicode(self.cp)
@@ -273,6 +277,16 @@ class PackageModel(AbstractDateTimeModel):
def cp(self):
return self.virtual_package.cp
+ @property
+ def cpr(self):
+ return '%s::%s' % (self.cp, self.repository.name)
+
+ def cp_or_cpr(self):
+ if self.repository.name == 'gentoo':
+ return self.cp
+ else:
+ return self.cpr
+
def init_by_package(self, package, category = None, virtual_package = None):
#self.name = package.name
self.update_info(package)
@@ -324,10 +338,7 @@ class PackageModel(AbstractDateTimeModel):
@models.permalink
def get_absolute_url(self):
# It coold been in many repositories
- kwargs = { 'category': self.virtual_package.category.category,
- 'name': self.virtual_package.name }
- if self.repository.name != 'gentoo':
- kwargs['repository'] = self.repository.name
+ kwargs = { 'cpr': self.cp_or_cpr() }
return ('package',(), kwargs )
class Meta:
@@ -460,10 +471,24 @@ class EbuildModel(AbstractDateTimeModel):
return self.package.cp
@property
+ def cpr(self):
+ return self.package.cpr
+
+ @property
def cpv(self):
return '%s-%s' % (self.package, self.fullversion)
@property
+ def cpvr(self):
+ return '%s::%s' % (self.cpv, self.package.repository.name)
+
+ def cpv_or_cpvr(self):
+ if self.package.repository.name == 'gentoo':
+ return self.cpv
+ else:
+ return self.cpvr
+
+ @property
def fullversion(self):
return '%s%s' % (self.version, ('-'+ self.revision if self.revision else ''))
@@ -503,6 +528,16 @@ class EbuildModel(AbstractDateTimeModel):
self.keywords = self.get_keywords(arch_list)
return (self, )
+ @models.permalink
+ def get_absolute_url_by_pk(self):
+ return ('ebuild',(), {'pk': self.pk})
+
+ @models.permalink
+ def get_absolute_url(self):
+ # It coold been in many repositories
+ kwargs = { 'cpvr': self.cpv_or_cpvr() }
+ return ('ebuild',(), kwargs )
+
class Meta:
unique_together = ('package', 'version', 'revision')
ordering = ('-updated_datetime',)
diff --git a/gpackages/apps/packages/urls.py b/gpackages/apps/packages/urls.py
index 4d47a08..1eb23ef 100644
--- a/gpackages/apps/packages/urls.py
+++ b/gpackages/apps/packages/urls.py
@@ -13,10 +13,11 @@ urlpatterns = patterns('',
url(r'^license-groups/$', LicenseGroupsView.as_view(), name = 'license_groups'),
url(r'^$', EbuildsListView.as_view(), name = 'ebuilds'),
url(r'^ebuild/(?P<pk>\d+)/$', EbuildDetailView.as_view(), name = 'ebuild'),
+ url(r'^ebuild/(?P<cpvr>[^/]+/[^/]+)/$', EbuildDetailView.as_view(), name = 'ebuild'),
url(r'^packages/{0}$'.format(PackagesListsView.get_url_part()), PackagesListsView.as_view(), name = 'packages'),
# In Future I will write my onw URL Resolver !!!
#url(r'^package/(?:(?P<pk>\d+)|(?P<category>[^/]+)/(?P<name>[^/]+))/$', PackageDetailView.as_view(), name = 'package'),
url(r'^package/(?P<pk>\d+)/$', PackageDetailView.as_view(), name = 'package'),
- url(r'^package/(?P<category>[^/]+)/(?P<name>[^/:]+)(?:::(?P<repository>[^/]+))?/$', PackageDetailView.as_view(), name = 'package'),
+ url(r'^package/(?P<cpr>[^/]+/[^/]+)/$', PackageDetailView.as_view(), name = 'package'),
)
diff --git a/gpackages/apps/packages/utils.py b/gpackages/apps/packages/utils.py
new file mode 100644
index 0000000..fc2bd8d
--- /dev/null
+++ b/gpackages/apps/packages/utils.py
@@ -0,0 +1,96 @@
+import re
+from .validators import REVISION_RE, VERSION_RE, NAME_RE
+from package_info.generic import ToStrMixin
+
+def gen_args(args):
+ t = '%s=%s'
+ l = (t % arg for arg in args)
+ return '&'.join(l)
+
+def get_link(host, script, args):
+ return 'http://%(host)s/%(script)s?%(args)' % {'host': host,
+ 'script': script,
+ 'args': get_args(args)}
+
+BASE_PACKAGE_RE_P = r'(?P<category>[^/]+)/(?P<name>%(name)s)' % \
+ {'name' : NAME_RE}
+
+REPOSITORY_RE_P = r'(?:::(?P<repository>\w+))?'
+
+PACKAGE_RE_P = r'%(base)s%(repository)s' % {'base' : BASE_PACKAGE_RE_P,
+ 'repository' : REPOSITORY_RE_P}
+
+PACKAGE_RE = r'^%s$' % PACKAGE_RE_P
+
+VERSIONS_RE_P = r'-(?P<version>%(version)s)(?:-(?P<revision>%(revision)s))?' % \
+ { 'version' : VERSION_RE,
+ 'revision': REVISION_RE
+ }
+EBUILD_CPVR_RE_P = r'%(base)s%(versions)s%(repository)s' % {
+ 'base': BASE_PACKAGE_RE_P,
+ 'versions': VERSIONS_RE_P,
+ 'repository': REPOSITORY_RE_P
+ }
+
+EBUILD_CPVR_RE = r'^%s$' % EBUILD_CPVR_RE_P
+
+ebuild_cpvr_re = re.compile(EBUILD_CPVR_RE)
+package_re = re.compile(PACKAGE_RE)
+
+def _gen_func(name):
+ return lambda self: self.gr_dict.get(name)
+
+class ParseMetaClass(type):
+
+ def __init__(cls, name, bases, dct):
+ super(ParseMetaClass, cls).__init__(name, bases, dct)
+ for v in cls.simple_attrs:
+ setattr(cls, v, property(_gen_func(v)))
+
+class PackageParse(ToStrMixin):
+
+ __metaclass__ = ParseMetaClass
+ re = package_re
+ simple_attrs = ('category', 'name', 'repository')
+
+ def __init__(self, parse = None, dct = None):
+ assert parse or dct, 'Shoud set or parse or dct'
+ self.parse_str = parse
+
+ if parse is not None:
+ m = self.re.match(parse)
+ self.gr_dict = {}
+ if m is not None:
+ self.gr_dict = m.groupdict()
+ elif dct is not None:
+ self.gr_dict = dct
+
+ def __unicode__(self):
+ return unicode(self.parse_str)
+
+ @property
+ def re_str(self):
+ return PACKAGE_RE_P
+
+ @property
+ def repository_for_q(self):
+ if self.repository:
+ return self.repository
+ else:
+ return 'gentoo'
+
+class EbuildParse(PackageParse):
+
+ re = ebuild_cpvr_re
+ simple_attrs = ('category', 'name', 'repository', 'version', 'revision')
+
+ @property
+ def re_str(self):
+ return EBUILD_CPVR_RE_P
+
+ @property
+ def revision_for_q(self):
+ if self.revision:
+ return self.revision
+ else:
+ return ''
diff --git a/gpackages/apps/packages/validators.py b/gpackages/apps/packages/validators.py
new file mode 100644
index 0000000..efe0c00
--- /dev/null
+++ b/gpackages/apps/packages/validators.py
@@ -0,0 +1,8 @@
+from django.core.validators import URLValidator, validate_email
+from django.core.exceptions import ValidationError
+
+validate_url = URLValidator()
+
+REVISION_RE = r'r\d+'
+VERSION_RE = r'[\w.]+'
+NAME_RE = r'[\w+-]+'
diff --git a/gpackages/apps/packages/views.py b/gpackages/apps/packages/views.py
index 81bb609..3d239ae 100644
--- a/gpackages/apps/packages/views.py
+++ b/gpackages/apps/packages/views.py
@@ -6,6 +6,7 @@ from models import CategoryModel, HerdsModel, MaintainerModel, \
PackageModel, UseFlagModel
from django.shortcuts import get_object_or_404
+from .utils import EbuildParse, PackageParse
arches = ['alpha', 'amd64', 'arm', 'hppa', 'ia64', 'ppc', 'ppc64', 'sparc', 'x86']
@@ -49,6 +50,7 @@ class EbuildsListView(ContextListView):
select_related('package',
'package__virtual_package',
'package__virtual_package__category'). \
+ prefetch_related('package__repository'). \
prefetch_keywords(arches)
class EbuildDetailView(ContextView, DetailView):
@@ -61,6 +63,25 @@ class EbuildDetailView(ContextView, DetailView):
'package__virtual_package__category'). \
prefetch_keywords(arches)
+ def get_object(self, queryset = None):
+ pk = self.kwargs.get('pk')
+ if pk is not None:
+ return super(EbuildDetailView, self).get_object(queryset)
+ if queryset is None:
+ queryset = self.get_queryset()
+
+ cpvr = self.kwargs.get('cpvr')
+ eo = EbuildParse(cpvr)
+ category, name = eo.category, eo.name
+ version, revision = eo.version, eo.revision_for_q
+ repository = eo.repository_for_q
+ obj = get_object_or_404(queryset, package__virtual_package__name = name,
+ package__virtual_package__category__category = category,
+ package__repository__name = repository,
+ version = version,
+ revision = revision)
+ return obj
+
class PackagesListsView(MultipleFilterListViewMixin, ContextListView):
allowed_filter = { 'category':'virtual_package__category__category',
'repo':'repository__name',
@@ -112,10 +133,10 @@ class PackageDetailView(ContextView, DetailView):
if queryset is None:
queryset = self.get_queryset()
- name, category = self.kwargs.get('name'), self.kwargs.get('category')
- repository = self.kwargs.get('repository')
- if repository is None:
- repository = 'gentoo'
+ cpr = self.kwargs.get('cpr')
+ po = PackageParse(cpr)
+ category, name = po.category, po.name
+ repository = po.repository_for_q
obj = get_object_or_404(queryset, name = name,
category = category,
repository__name = repository)
diff --git a/gpackages/templates/keywords_table.html b/gpackages/templates/keywords_table.html
index 63c4be1..93339eb 100644
--- a/gpackages/templates/keywords_table.html
+++ b/gpackages/templates/keywords_table.html
@@ -1,4 +1,3 @@
-{% load url from future %}
{% spaceless %}
<table class="keywords table table-bordered table-condensed">
<colgroup>
@@ -19,7 +18,7 @@
<tbody>
{% for ebuild in ebuilds %}
<tr>
- <td class="ebuild"><a href="{% url 'ebuild' pk=ebuild.pk %}">{{ ebuild.fullversion }}</a></td>
+ <td class="ebuild"><a href="{{ ebuild.get_absolute_url }}">{{ ebuild.fullversion }}</a></td>
{% for keyword in ebuild.keywords %}
<td class="{{ keyword.status_class }}">{{ keyword.status_repr }}</td>
{% endfor %}
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-07-04 22:13 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-07-04 22:13 UTC (permalink / raw
To: gentoo-commits
commit: 1cf4caecb751b6d7990e60c0e5382642e73e93ee
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Wed Jul 4 13:50:32 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Wed Jul 4 13:50:32 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=1cf4caec
Add views for portage news
---
gpackages/apps/packages/models.py | 6 +++++-
gpackages/apps/packages/urls.py | 6 ++++--
gpackages/apps/packages/views.py | 18 +++++++++++++++++-
gpackages/templates/base.html | 14 +++++++++++---
gpackages/templates/portage_news.html | 13 +++++++++++++
gpackages/templates/portage_news_item.html | 4 ++++
gpackages/templates/portage_news_object.html | 22 ++++++++++++++++++++++
7 files changed, 76 insertions(+), 7 deletions(-)
diff --git a/gpackages/apps/packages/models.py b/gpackages/apps/packages/models.py
index 7c21a46..c5a51e3 100644
--- a/gpackages/apps/packages/models.py
+++ b/gpackages/apps/packages/models.py
@@ -14,7 +14,7 @@ from django.utils.html import urlize, linebreaks
def simple_markup(value):
- temp = urlize(value,trim_url_limit = 57, autoescape=True) # maybe nofollow
+ temp = urlize(value,trim_url_limit = 70, autoescape=True) # maybe nofollow
return linebreaks(temp)
class AbstractDateTimeModel(models.Model):
@@ -47,6 +47,10 @@ class PortageNewsModel(AbstractDateTimeModel):
objects = managers.PortageNewsManager()
+ @models.permalink
+ def get_absolute_url(self):
+ return ('news_item',(), {'pk': self.pk})
+
def init_by_news(self, news):
self.date = news.date
self.name = news.name
diff --git a/gpackages/apps/packages/urls.py b/gpackages/apps/packages/urls.py
index 1eb23ef..c7e6ac5 100644
--- a/gpackages/apps/packages/urls.py
+++ b/gpackages/apps/packages/urls.py
@@ -2,7 +2,7 @@ from django.conf.urls import patterns, include, url
from views import CategoriesListView, HerdsListView, MaintainersListView, \
RepositoriesListView, LicenseGroupsView , EbuildsListView, \
PackagesListsView, PackageDetailView, EbuildDetailView, \
- GlobalUseListView
+ GlobalUseListView, NewsListView, NewsDetailView
urlpatterns = patterns('',
url(r'^categories/$', CategoriesListView.as_view(), name = 'categories'),
@@ -16,8 +16,10 @@ urlpatterns = patterns('',
url(r'^ebuild/(?P<cpvr>[^/]+/[^/]+)/$', EbuildDetailView.as_view(), name = 'ebuild'),
url(r'^packages/{0}$'.format(PackagesListsView.get_url_part()), PackagesListsView.as_view(), name = 'packages'),
- # In Future I will write my onw URL Resolver !!!
#url(r'^package/(?:(?P<pk>\d+)|(?P<category>[^/]+)/(?P<name>[^/]+))/$', PackageDetailView.as_view(), name = 'package'),
url(r'^package/(?P<pk>\d+)/$', PackageDetailView.as_view(), name = 'package'),
url(r'^package/(?P<cpr>[^/]+/[^/]+)/$', PackageDetailView.as_view(), name = 'package'),
+ url(r'^news/$', NewsListView.as_view(), name = 'news'),
+ url(r'^news/(?P<pk>\d+)/$', NewsDetailView.as_view(), name = 'news_item'),
+ url(r'^news/(?P<slug>[^/]+)/$', NewsDetailView.as_view(), name = 'news_item'),
)
diff --git a/gpackages/apps/packages/views.py b/gpackages/apps/packages/views.py
index a0ce56a..32a2aee 100644
--- a/gpackages/apps/packages/views.py
+++ b/gpackages/apps/packages/views.py
@@ -3,7 +3,7 @@ from generic.views import ContextListView, ContextTemplateView, ContextView, \
MultipleFilterListViewMixin
from models import CategoryModel, HerdsModel, MaintainerModel, \
RepositoryModel, LicenseGroupModel, EbuildModel, \
- PackageModel, UseFlagModel
+ PackageModel, UseFlagModel, PortageNewsModel
from django.shortcuts import get_object_or_404
from package_info.parse_cp import EbuildParseCPVR, PackageParseCPR
@@ -147,3 +147,19 @@ class GlobalUseListView(ContextListView):
template_name = 'global_use.html'
context_object_name = 'uses'
queryset = UseFlagModel.objects.exclude(description = '')
+
+class NewsListView(ContextListView):
+ extra_context = {'page_name': 'News'}
+ template_name = 'portage_news.html'
+ context_object_name = 'news'
+ paginate_by = 20
+ queryset = PortageNewsModel.objects.filter(lang = 'en'). \
+ prefetch_related('authors', 'translators')
+
+class NewsDetailView(ContextView, DetailView):
+ extra_context = {'page_name': 'News Item'}
+ template_name = 'portage_news_item.html'
+ context_object_name = 'news_item'
+ slug_field = 'name'
+ queryset = PortageNewsModel.objects.filter(lang = 'en'). \
+ prefetch_related('authors', 'translators')
diff --git a/gpackages/templates/base.html b/gpackages/templates/base.html
index 172dd9d..8c8ccb6 100644
--- a/gpackages/templates/base.html
+++ b/gpackages/templates/base.html
@@ -24,22 +24,29 @@
.package-well {
padding: 10px 10px 0px 10px;
}
-
.package-name {
border-radius: 6px 6px 6px 6px;
padding: 8px 10px 8px 10px;
margin: 0px 0px 10px 0px;
background-color: #CCC;
}
-
.nowrap {
white-space: nowrap;
}
-
.package_update_datetime {
text-align: right;
float: right;
}
+ .metadata {
+ font-size: 11px;
+ color: grey;
+ }
+ .metadata span {
+ display: block;
+ }
+ .news_item {
+ padding-top: 15px;
+ }
</style>
<link href="{{ STATIC_URL }}css/bootstrap-responsive.css" rel="stylesheet">
@@ -66,6 +73,7 @@
<ul class="nav">
{% get_flatpages '/about/' as about_pages %}
<li class="{% active_str '/' %}"><a href="/">Home</a></li>
+ {% active_link 'news' 'Portage News' %}
{% for about in about_pages %}<li class="{% active_str about.url %}"><a href="{{ about.url }}">{{ about.title }}</a></li>{% endfor %}
<li><a href="#contact">Contact</a></li>
</ul>
diff --git a/gpackages/templates/portage_news.html b/gpackages/templates/portage_news.html
new file mode 100644
index 0000000..ee0bfc2
--- /dev/null
+++ b/gpackages/templates/portage_news.html
@@ -0,0 +1,13 @@
+{% extends "base.html" %}
+{% load url from future %}
+{% load paginator %}
+
+{% block content %}
+
+{% for news_item in news %}
+ {% include 'portage_news_object.html' %}
+{% endfor %}
+
+{% paginator page_obj 3 1 %}
+
+{% endblock content %}
diff --git a/gpackages/templates/portage_news_item.html b/gpackages/templates/portage_news_item.html
new file mode 100644
index 0000000..9f4c711
--- /dev/null
+++ b/gpackages/templates/portage_news_item.html
@@ -0,0 +1,4 @@
+{% extends "base.html" %}
+{% block content %}
+ {% include 'portage_news_object.html' %}
+{% endblock content %}
diff --git a/gpackages/templates/portage_news_object.html b/gpackages/templates/portage_news_object.html
new file mode 100644
index 0000000..fc03658
--- /dev/null
+++ b/gpackages/templates/portage_news_object.html
@@ -0,0 +1,22 @@
+{% load url from future %}
+<div class="news_item">
+ <h2><a href="{% url 'news_item' slug=news_item.name %}">{{ news_item.title }}</a></h2>
+ <p>{{ news_item.message_as_html|safe }}</p>
+ <div class="metadata" >
+ <span>Date: {{ news_item.date }}</span>
+ <span>Revision: {{ news_item.revision }}</span>
+ {% with authors=news_item.authors.all %}
+ <span>
+ {% if authors|length_is:"1" %}
+ Author:
+ {% else %}
+ Authors:
+ {% endif %}
+ {% for author in authors %}
+ <a href="{% url 'packages' maintainer=author.pk %}">{{ author.name }}</a>
+ {% if not forloop.last %},{% endif %}
+ {% endfor %}
+ </span>
+ {% endwith %}
+ </div>
+</div>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-07-06 23:09 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-07-06 23:09 UTC (permalink / raw
To: gentoo-commits
commit: b747d18196f04eb502665262ba1224a9db790478
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Fri Jul 6 20:44:26 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Fri Jul 6 20:44:26 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=b747d181
Add new packages shortcut
---
gpackages/apps/packages/urls.py | 1 +
gpackages/templates/base.html | 1 +
2 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/gpackages/apps/packages/urls.py b/gpackages/apps/packages/urls.py
index 75d7b5a..5ee5654 100644
--- a/gpackages/apps/packages/urls.py
+++ b/gpackages/apps/packages/urls.py
@@ -16,6 +16,7 @@ urlpatterns = patterns('',
url(r'^ebuild/(?P<pk>\d+)/$', EbuildDetailView.as_view(), name = 'ebuild'),
url(r'^ebuild/(?P<cpvr>[^/]+/[^/]+)/$', EbuildDetailView.as_view(), name = 'ebuild'),
url(r'^packages/{0}$'.format(PackagesListsView.get_url_part()), PackagesListsView.as_view(), name = 'packages'),
+ url(r'^newpackages/$', PackagesListsView.as_view(), kwargs = {'order': 'create', 'rev': 'rev'},name = 'newpackages'),
#url(r'^package/(?:(?P<pk>\d+)|(?P<category>[^/]+)/(?P<name>[^/]+))/$', PackageDetailView.as_view(), name = 'package'),
url(r'^package/(?P<pk>\d+)/$', PackageDetailView.as_view(), name = 'package'),
diff --git a/gpackages/templates/base.html b/gpackages/templates/base.html
index 8c8ccb6..d0726df 100644
--- a/gpackages/templates/base.html
+++ b/gpackages/templates/base.html
@@ -142,6 +142,7 @@ Text
{% active_link 'categories' 'Categories' %}
{% active_link 'ebuilds' 'Ebuilds' %}
{% active_link 'packages' 'Packages' %}
+ {% active_link 'newpackages' 'New Packages' %}
{% active_link 'maintainers' 'Maintainers' %}
{% active_link 'herds' 'Herds' %}
{% active_link 'repositories' 'Repositories' %}
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-07-06 23:09 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-07-06 23:09 UTC (permalink / raw
To: gentoo-commits
commit: 7d160ccc4ee1a435e7c1db984b25f72d479a24aa
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Fri Jul 6 20:34:23 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Fri Jul 6 20:34:23 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=7d160ccc
Add license detail view
---
gpackages/apps/packages/models.py | 4 ++++
gpackages/apps/packages/urls.py | 4 +++-
gpackages/apps/packages/views.py | 10 +++++++++-
gpackages/templates/license.html | 9 +++++++++
4 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/gpackages/apps/packages/models.py b/gpackages/apps/packages/models.py
index c89db88..c6d8823 100644
--- a/gpackages/apps/packages/models.py
+++ b/gpackages/apps/packages/models.py
@@ -499,6 +499,10 @@ class LicenseModel(StatsModel):
# Autogenerated fields for fast stats
#ebuilds_count = models.PositiveIntegerField(default = 0)
+
+ @models.permalink
+ def get_absolute_url(self):
+ return ('license', (), {'slug': self.name})
def __unicode__(self):
return self.name
diff --git a/gpackages/apps/packages/urls.py b/gpackages/apps/packages/urls.py
index c7e6ac5..75d7b5a 100644
--- a/gpackages/apps/packages/urls.py
+++ b/gpackages/apps/packages/urls.py
@@ -2,7 +2,8 @@ from django.conf.urls import patterns, include, url
from views import CategoriesListView, HerdsListView, MaintainersListView, \
RepositoriesListView, LicenseGroupsView , EbuildsListView, \
PackagesListsView, PackageDetailView, EbuildDetailView, \
- GlobalUseListView, NewsListView, NewsDetailView
+ GlobalUseListView, NewsListView, NewsDetailView, \
+ LicenseDetailView
urlpatterns = patterns('',
url(r'^categories/$', CategoriesListView.as_view(), name = 'categories'),
@@ -22,4 +23,5 @@ urlpatterns = patterns('',
url(r'^news/$', NewsListView.as_view(), name = 'news'),
url(r'^news/(?P<pk>\d+)/$', NewsDetailView.as_view(), name = 'news_item'),
url(r'^news/(?P<slug>[^/]+)/$', NewsDetailView.as_view(), name = 'news_item'),
+ url(r'^license/(?P<slug>[^/]+)/$', LicenseDetailView.as_view(), name = 'license'),
)
diff --git a/gpackages/apps/packages/views.py b/gpackages/apps/packages/views.py
index 32a2aee..7d6322d 100644
--- a/gpackages/apps/packages/views.py
+++ b/gpackages/apps/packages/views.py
@@ -3,7 +3,7 @@ from generic.views import ContextListView, ContextTemplateView, ContextView, \
MultipleFilterListViewMixin
from models import CategoryModel, HerdsModel, MaintainerModel, \
RepositoryModel, LicenseGroupModel, EbuildModel, \
- PackageModel, UseFlagModel, PortageNewsModel
+ PackageModel, UseFlagModel, PortageNewsModel, LicenseModel
from django.shortcuts import get_object_or_404
from package_info.parse_cp import EbuildParseCPVR, PackageParseCPR
@@ -163,3 +163,11 @@ class NewsDetailView(ContextView, DetailView):
slug_field = 'name'
queryset = PortageNewsModel.objects.filter(lang = 'en'). \
prefetch_related('authors', 'translators')
+
+class LicenseDetailView(ContextView, DetailView):
+ extra_context = {'page_name': 'Licens'}
+ template_name = 'license.html'
+ context_object_name = 'license'
+ slug_field = 'name'
+ queryset = LicenseModel.objects.all()
+
diff --git a/gpackages/templates/license.html b/gpackages/templates/license.html
new file mode 100644
index 0000000..40bcf6e
--- /dev/null
+++ b/gpackages/templates/license.html
@@ -0,0 +1,9 @@
+{% extends "base.html" %}
+{% block content %}
+<div class="license">
+ <h2>{{ license.name }}</h2>
+ <div class="license_content">
+ {{ license.text|linebreaks|urlize }}
+ </div>
+</div>
+{% endblock content %}
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-07-08 19:54 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-07-08 19:54 UTC (permalink / raw
To: gentoo-commits
commit: c0e24d2d15775b3e53d00027a9d138dc42f6b2df
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Sat Jul 7 16:53:32 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Sat Jul 7 17:12:10 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=c0e24d2d
Add arch choices view
---
gpackages/apps/packages/forms.py | 13 +++++++++
gpackages/apps/packages/urls.py | 3 +-
gpackages/apps/packages/views.py | 47 ++++++++++++++++++++++++++++------
gpackages/apps/packages/widgets.py | 42 ++++++++++++++++++++++++++++++
gpackages/templates/arch_choice.html | 10 +++++++
gpackages/templates/base.html | 3 +-
6 files changed, 108 insertions(+), 10 deletions(-)
diff --git a/gpackages/apps/packages/forms.py b/gpackages/apps/packages/forms.py
new file mode 100644
index 0000000..39dab08
--- /dev/null
+++ b/gpackages/apps/packages/forms.py
@@ -0,0 +1,13 @@
+from django import forms
+from .models import ArchesModel
+from .widgets import DivCheckboxSelectMultiple
+
+# Need rerun if database are empty
+arches = ArchesModel.objects.exclude(name = '*').order_by('name').values_list('name', 'name')
+
+
+class ArchChoiceForm(forms.Form):
+ arches = forms.MultipleChoiceField(
+ widget = DivCheckboxSelectMultiple,
+ #widget = forms.CheckboxSelectMultiple(attrs = {'class': 'inline checkbox'}),
+ choices = arches)
diff --git a/gpackages/apps/packages/urls.py b/gpackages/apps/packages/urls.py
index 5ee5654..40fef62 100644
--- a/gpackages/apps/packages/urls.py
+++ b/gpackages/apps/packages/urls.py
@@ -3,7 +3,7 @@ from views import CategoriesListView, HerdsListView, MaintainersListView, \
RepositoriesListView, LicenseGroupsView , EbuildsListView, \
PackagesListsView, PackageDetailView, EbuildDetailView, \
GlobalUseListView, NewsListView, NewsDetailView, \
- LicenseDetailView
+ LicenseDetailView, ArchChoiceView
urlpatterns = patterns('',
url(r'^categories/$', CategoriesListView.as_view(), name = 'categories'),
@@ -25,4 +25,5 @@ urlpatterns = patterns('',
url(r'^news/(?P<pk>\d+)/$', NewsDetailView.as_view(), name = 'news_item'),
url(r'^news/(?P<slug>[^/]+)/$', NewsDetailView.as_view(), name = 'news_item'),
url(r'^license/(?P<slug>[^/]+)/$', LicenseDetailView.as_view(), name = 'license'),
+ url(r'^arches/$', ArchChoiceView.as_view(), name = 'archchoice'),
)
diff --git a/gpackages/apps/packages/views.py b/gpackages/apps/packages/views.py
index 7d6322d..1123d5a 100644
--- a/gpackages/apps/packages/views.py
+++ b/gpackages/apps/packages/views.py
@@ -1,15 +1,31 @@
-from django.views.generic import DetailView
+from django.views.generic import DetailView, FormView, ListView
from generic.views import ContextListView, ContextTemplateView, ContextView, \
MultipleFilterListViewMixin
-from models import CategoryModel, HerdsModel, MaintainerModel, \
- RepositoryModel, LicenseGroupModel, EbuildModel, \
- PackageModel, UseFlagModel, PortageNewsModel, LicenseModel
+from .models import CategoryModel, HerdsModel, MaintainerModel, \
+ RepositoryModel, LicenseGroupModel, EbuildModel, \
+ PackageModel, UseFlagModel, PortageNewsModel, LicenseModel
+from .forms import ArchChoiceForm
from django.shortcuts import get_object_or_404
from package_info.parse_cp import EbuildParseCPVR, PackageParseCPR
arches = ['alpha', 'amd64', 'arm', 'hppa', 'ia64', 'ppc', 'ppc64', 'sparc', 'x86']
+class ArchesViewMixin(object):
+ def get_arches(self):
+ arches_s = self.request.session.get('arches')
+ return arches_s or arches
+
+
+class ArchesContexView(ArchesViewMixin, ContextView):
+ def get_context_data(self, **kwargs):
+ ret = super(ArchesContexView, self).get_context_data(**kwargs)
+ ret.update({'arches': self.get_arches()})
+ return ret
+
+class ContextArchListView(ArchesContexView, ListView):
+ pass
+
class CategoriesListView(ContextListView):
extra_context = {'page_name': 'Categories',}
template_name = 'categories.html'
@@ -41,7 +57,7 @@ class LicenseGroupsView(ContextListView):
template_name = 'license_groups.html'
context_object_name = 'license_groups'
-class EbuildsListView(ContextListView):
+class EbuildsListView(ContextArchListView):
paginate_by = 40
extra_context = {'page_name': 'Ebuilds', 'arches' : arches}
template_name = 'ebuilds.html'
@@ -53,7 +69,7 @@ class EbuildsListView(ContextListView):
prefetch_related('package__repository'). \
prefetch_keywords(arches)
-class EbuildDetailView(ContextView, DetailView):
+class EbuildDetailView(ArchesContexView, DetailView):
template_name = 'ebuild.html'
extra_context = {'page_name': 'Ebuild', 'arches': arches}
context_object_name = 'ebuild'
@@ -82,7 +98,7 @@ class EbuildDetailView(ContextView, DetailView):
revision = revision)
return obj
-class PackagesListsView(MultipleFilterListViewMixin, ContextListView):
+class PackagesListsView(MultipleFilterListViewMixin, ContextArchListView):
allowed_filter = { 'category':'virtual_package__category__category',
'repo':'repository__name',
'herd':'herds__name',
@@ -116,7 +132,7 @@ class PackagesListsView(MultipleFilterListViewMixin, ContextListView):
prefetch_related('repository', 'herds', 'maintainers'). \
prefetch_keywords(arches)
-class PackageDetailView(ContextView, DetailView):
+class PackageDetailView(ArchesContexView, DetailView):
template_name = 'package.html'
extra_context = {'page_name': 'Package', 'arches': arches}
context_object_name = 'package'
@@ -171,3 +187,18 @@ class LicenseDetailView(ContextView, DetailView):
slug_field = 'name'
queryset = LicenseModel.objects.all()
+class ArchChoiceView(ArchesViewMixin, FormView):
+ form_class = ArchChoiceForm
+ template_name = 'arch_choice.html'
+ success_url = '/'
+
+ def get_initial(self):
+ arches = self.get_arches()
+ return {'arches': arches }
+
+ def form_valid(self, form):
+ arches = form.cleaned_data['arches']
+ # Maybe save it to cookies ?
+ # arches_str = ','.join(arches)
+ self.request.session['arches'] = arches
+ return super(ArchChoiceView, self).form_valid(form)
diff --git a/gpackages/apps/packages/widgets.py b/gpackages/apps/packages/widgets.py
new file mode 100644
index 0000000..047d0e2
--- /dev/null
+++ b/gpackages/apps/packages/widgets.py
@@ -0,0 +1,42 @@
+from django import forms
+from django.utils.safestring import mark_safe
+from django.utils.encoding import smart_unicode, force_unicode
+from itertools import chain
+
+class DivCheckboxSelectMultiple(forms.CheckboxSelectMultiple):
+ def render(self, name, value, attrs=None, choices=()):
+ if value is None: value = []
+ has_id = attrs and 'id' in attrs
+ final_attrs = self.build_attrs(attrs, name=name)
+ output = ['<div class="row-fluid">']
+ # Normalize to strings
+ str_values = set([force_unicode(v) for v in value])
+ row1, row2 = ['<div class="span6">'], ['<div class="span6">']
+ for i, (option_value, option_label) in enumerate(chain(self.choices, choices)):
+ # If an ID attribute was given, add a numeric index as a suffix,
+ # so that the checkboxes don't all have the same ID attribute.
+ if has_id:
+ final_attrs = dict(final_attrs, id='%s_%s' % (attrs['id'], i))
+ label_for = ' for="{0}"'.format(final_attrs['id'])
+ else:
+ label_for = ''
+
+ label_for += ' class="control-label"'
+
+ cb = forms.CheckboxInput(final_attrs, check_test=lambda value: value in str_values)
+ option_value = force_unicode(option_value)
+ rendered_cb = cb.render(name, option_value)
+ option_label = force_unicode(option_label)
+ if i % 2:
+ arr = row2
+ else:
+ arr = row1
+
+ arr.append('<label{0}>{1} {2}</label>'.format(
+ label_for, rendered_cb, option_label))
+
+ row1.append('</div>')
+ row2.append('</div>')
+ output.extend(row1 + row2)
+ output.append('</div>')
+ return mark_safe('\n'.join(output))
diff --git a/gpackages/templates/arch_choice.html b/gpackages/templates/arch_choice.html
new file mode 100644
index 0000000..0b03c61
--- /dev/null
+++ b/gpackages/templates/arch_choice.html
@@ -0,0 +1,10 @@
+{% extends 'base.html' %}
+
+{% block content %}
+<div class="arches">
+<form action="./" method="post" enctype="multipart/form-data">{% csrf_token %}
+ {{ form.as_ul }}
+ <input type="submit" value="Submit" />
+</form>
+</div>
+{% endblock content %}
diff --git a/gpackages/templates/base.html b/gpackages/templates/base.html
index a42f5da..6abe005 100644
--- a/gpackages/templates/base.html
+++ b/gpackages/templates/base.html
@@ -80,7 +80,7 @@
<div class="row">
<div class="span9" id="content">
{% block content %}
-Text
+ Text
{% endblock content %}
</div> <!-- span9 -->
@@ -113,6 +113,7 @@ Text
{% active_link 'repositories' 'Repositories' %}
{% active_link 'license_groups' 'License Groups' %}
{% active_link 'global_uses' 'Global Use Flags' %}
+ {% active_link 'archchoice' 'Select Arches' %}
</ul>
</div>
{% recent_ebuilds %}
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-07-08 19:54 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-07-08 19:54 UTC (permalink / raw
To: gentoo-commits
commit: a7c505236c696229157e7fe5ea88600b54936ddc
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Sun Jul 8 17:20:41 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Sun Jul 8 17:20:41 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=a7c50523
Add licenses view
---
gpackages/apps/packages/urls.py | 3 ++-
gpackages/apps/packages/views.py | 8 ++++++++
gpackages/templates/base.html | 1 +
gpackages/templates/licenses.html | 13 +++++++++++++
4 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/gpackages/apps/packages/urls.py b/gpackages/apps/packages/urls.py
index 40fef62..44b9f96 100644
--- a/gpackages/apps/packages/urls.py
+++ b/gpackages/apps/packages/urls.py
@@ -3,7 +3,7 @@ from views import CategoriesListView, HerdsListView, MaintainersListView, \
RepositoriesListView, LicenseGroupsView , EbuildsListView, \
PackagesListsView, PackageDetailView, EbuildDetailView, \
GlobalUseListView, NewsListView, NewsDetailView, \
- LicenseDetailView, ArchChoiceView
+ LicenseDetailView, ArchChoiceView, LicensesListView
urlpatterns = patterns('',
url(r'^categories/$', CategoriesListView.as_view(), name = 'categories'),
@@ -26,4 +26,5 @@ urlpatterns = patterns('',
url(r'^news/(?P<slug>[^/]+)/$', NewsDetailView.as_view(), name = 'news_item'),
url(r'^license/(?P<slug>[^/]+)/$', LicenseDetailView.as_view(), name = 'license'),
url(r'^arches/$', ArchChoiceView.as_view(), name = 'archchoice'),
+ url(r'^licenses/$', LicensesListView.as_view(), name = 'licenses'),
)
diff --git a/gpackages/apps/packages/views.py b/gpackages/apps/packages/views.py
index 13266c4..a861531 100644
--- a/gpackages/apps/packages/views.py
+++ b/gpackages/apps/packages/views.py
@@ -180,6 +180,14 @@ class NewsDetailView(ContextView, DetailView):
queryset = PortageNewsModel.objects.filter(lang = 'en'). \
prefetch_related('authors', 'translators')
+class LicensesListView(ContextListView):
+ extra_context = {'page_name': 'Licens'}
+ template_name = 'licenses.html'
+ context_object_name = 'licenses'
+ slug_field = 'name'
+ paginate_by = 20
+ queryset = LicenseModel.objects.all()
+
class LicenseDetailView(ContextView, DetailView):
extra_context = {'page_name': 'Licens'}
template_name = 'license.html'
diff --git a/gpackages/templates/base.html b/gpackages/templates/base.html
index 850c644..7fd70f3 100644
--- a/gpackages/templates/base.html
+++ b/gpackages/templates/base.html
@@ -114,6 +114,7 @@
{% active_link 'license_groups' 'License Groups' %}
{% active_link 'global_uses' 'Global Use Flags' %}
{% active_link 'archchoice' 'Select Arches' %}
+ {% active_link 'licenses' 'Licenses' %}
</ul>
</div>
{% recent_ebuilds %}
diff --git a/gpackages/templates/licenses.html b/gpackages/templates/licenses.html
new file mode 100644
index 0000000..eeb18d8
--- /dev/null
+++ b/gpackages/templates/licenses.html
@@ -0,0 +1,13 @@
+{% extends "base.html" %}
+{% load paginator %}
+{% block content %}
+ {% for license in licenses %}
+ <div class="license">
+ <h2><a href="{{ license.get_absolute_url }}">{{ license.name }}</a></h2>
+ <div class="license_content">
+ {{ license.text|truncatewords:50|linebreaks }}
+ </div>
+ </div>
+ {% endfor %}
+{% paginator page_obj 3 2 %}
+{% endblock content %}
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-07-08 19:54 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-07-08 19:54 UTC (permalink / raw
To: gentoo-commits
commit: 37aabe5a0fd8a9228f325bac4a86cc203d919d7a
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Sun Jul 8 17:41:05 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Sun Jul 8 17:41:05 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=37aabe5a
Add local use flags view
---
gpackages/apps/packages/urls.py | 4 +++-
gpackages/apps/packages/views.py | 11 +++++++++--
gpackages/templates/base.html | 1 +
gpackages/templates/local_use.html | 30 ++++++++++++++++++++++++++++++
4 files changed, 43 insertions(+), 3 deletions(-)
diff --git a/gpackages/apps/packages/urls.py b/gpackages/apps/packages/urls.py
index 44b9f96..a8e4cab 100644
--- a/gpackages/apps/packages/urls.py
+++ b/gpackages/apps/packages/urls.py
@@ -3,12 +3,14 @@ from views import CategoriesListView, HerdsListView, MaintainersListView, \
RepositoriesListView, LicenseGroupsView , EbuildsListView, \
PackagesListsView, PackageDetailView, EbuildDetailView, \
GlobalUseListView, NewsListView, NewsDetailView, \
- LicenseDetailView, ArchChoiceView, LicensesListView
+ LicenseDetailView, ArchChoiceView, LicensesListView, \
+ LocalUseListView
urlpatterns = patterns('',
url(r'^categories/$', CategoriesListView.as_view(), name = 'categories'),
url(r'^herds/$', HerdsListView.as_view(), name = 'herds'),
url(r'^use/$', GlobalUseListView.as_view(), name = 'global_uses'),
+ url(r'^local_use/$', LocalUseListView.as_view(), name = 'local_uses'),
url(r'^maintainers/$', MaintainersListView.as_view(), name = 'maintainers'),
url(r'^repositories/$', RepositoriesListView.as_view(), name = 'repositories'),
url(r'^license-groups/$', LicenseGroupsView.as_view(), name = 'license_groups'),
diff --git a/gpackages/apps/packages/views.py b/gpackages/apps/packages/views.py
index a861531..e359bd1 100644
--- a/gpackages/apps/packages/views.py
+++ b/gpackages/apps/packages/views.py
@@ -3,7 +3,8 @@ from generic.views import ContextListView, ContextTemplateView, ContextView, \
MultipleFilterListViewMixin
from .models import CategoryModel, HerdsModel, MaintainerModel, \
RepositoryModel, LicenseGroupModel, EbuildModel, \
- PackageModel, UseFlagModel, PortageNewsModel, LicenseModel
+ PackageModel, UseFlagModel, PortageNewsModel, \
+ UseFlagDescriptionModel, LicenseModel
from .forms import ArchChoiceForm
from django.shortcuts import get_object_or_404
@@ -164,6 +165,13 @@ class GlobalUseListView(ContextListView):
context_object_name = 'uses'
queryset = UseFlagModel.objects.exclude(description = '')
+class LocalUseListView(ContextListView):
+ extra_context = {'page_name': 'Local Use'}
+ template_name = 'local_use.html'
+ context_object_name = 'uses'
+ queryset = UseFlagDescriptionModel.objects.all().\
+ select_related('use_flag', 'package', 'package__category')
+
class NewsListView(ContextListView):
extra_context = {'page_name': 'News'}
template_name = 'portage_news.html'
@@ -184,7 +192,6 @@ class LicensesListView(ContextListView):
extra_context = {'page_name': 'Licens'}
template_name = 'licenses.html'
context_object_name = 'licenses'
- slug_field = 'name'
paginate_by = 20
queryset = LicenseModel.objects.all()
diff --git a/gpackages/templates/base.html b/gpackages/templates/base.html
index 7fd70f3..2f3c79a 100644
--- a/gpackages/templates/base.html
+++ b/gpackages/templates/base.html
@@ -113,6 +113,7 @@
{% active_link 'repositories' 'Repositories' %}
{% active_link 'license_groups' 'License Groups' %}
{% active_link 'global_uses' 'Global Use Flags' %}
+ {% active_link 'local_uses' 'Local Use Flags' %}
{% active_link 'archchoice' 'Select Arches' %}
{% active_link 'licenses' 'Licenses' %}
</ul>
diff --git a/gpackages/templates/local_use.html b/gpackages/templates/local_use.html
new file mode 100644
index 0000000..af13bf0
--- /dev/null
+++ b/gpackages/templates/local_use.html
@@ -0,0 +1,30 @@
+{% extends "base.html" %}
+{% load url from future %}
+
+{% block content %}
+
+<table class='table table-striped table-hover'>
+ <colgroup>
+ <col class="span1" >
+ <col class="span1" >
+ <col class="span9" >
+ </colgroup>
+ <thead>
+ <tr>
+ <th>Use flag</th>
+ <th>Package</th>
+ <th>Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for use in uses %}
+ <tr>
+ <td class="nowrap"><a href="{% url 'packages' use=use.use_flag.name %}">{{ use.use_flag.name }}</a></td>
+ <td class="nowrap">{{ use.package.cp }}</td>
+ <td>{{ use.description }}</td>
+ </tr>
+ {% endfor %}
+ </tbody>
+</table>
+
+{% endblock content %}
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-07-10 23:13 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-07-10 23:13 UTC (permalink / raw
To: gentoo-commits
commit: ccf2f1130d5b6f42235f56046de01a0baa7bb5cc
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Mon Jul 9 19:53:57 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Mon Jul 9 19:53:57 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=ccf2f113
Add simple filtering view
---
gpackages/apps/packages/forms.py | 35 ++++++++++++++++++++++++++++++-
gpackages/apps/packages/urls.py | 3 +-
gpackages/apps/packages/views.py | 28 +++++++++++++++++++++++-
gpackages/templates/base.html | 1 +
gpackages/templates/filtering_view.html | 19 ++++++++++++++++
5 files changed, 82 insertions(+), 4 deletions(-)
diff --git a/gpackages/apps/packages/forms.py b/gpackages/apps/packages/forms.py
index 39dab08..974eb63 100644
--- a/gpackages/apps/packages/forms.py
+++ b/gpackages/apps/packages/forms.py
@@ -1,5 +1,6 @@
from django import forms
-from .models import ArchesModel
+from .models import ArchesModel, RepositoryModel, CategoryModel, HerdsModel, \
+ UseFlagModel, MaintainerModel, LicenseModel
from .widgets import DivCheckboxSelectMultiple
# Need rerun if database are empty
@@ -11,3 +12,35 @@ class ArchChoiceForm(forms.Form):
widget = DivCheckboxSelectMultiple,
#widget = forms.CheckboxSelectMultiple(attrs = {'class': 'inline checkbox'}),
choices = arches)
+
+class FilteringForm(forms.Form):
+ def __init__(self, *args, **kwargs):
+ super(FilteringForm, self).__init__(*args, **kwargs)
+ repos = RepositoryModel.objects.all().order_by('name'). \
+ values_list('name', 'name')
+
+ categories = CategoryModel.objects.all().order_by('category'). \
+ values_list('category', 'category')
+
+ herds = HerdsModel.objects.all().order_by('name'). \
+ values_list('name','name')
+
+ uses = UseFlagModel.objects.all().order_by('name'). \
+ values_list('name', 'name')
+
+ #maintainers = MaintainerModel.all().order_by('email'). \
+ # values_list('pk', 'email')
+
+ licenses = LicenseModel.objects.all().order_by('name'). \
+ values_list('name', 'name')
+
+ names = ['repos', 'categories', 'herds', 'uses', 'licenses']
+ values = [repos, categories, herds, uses, licenses]
+ for k, v in zip(names, values):
+ self.fields[k].choices = v
+
+ repos = forms.MultipleChoiceField(required = False)
+ categories = forms.MultipleChoiceField(required = False)
+ herds = forms.MultipleChoiceField(required = False)
+ uses = forms.MultipleChoiceField(required = False)
+ licenses = forms.MultipleChoiceField(required = False)
diff --git a/gpackages/apps/packages/urls.py b/gpackages/apps/packages/urls.py
index a8e4cab..d7ebf49 100644
--- a/gpackages/apps/packages/urls.py
+++ b/gpackages/apps/packages/urls.py
@@ -4,7 +4,7 @@ from views import CategoriesListView, HerdsListView, MaintainersListView, \
PackagesListsView, PackageDetailView, EbuildDetailView, \
GlobalUseListView, NewsListView, NewsDetailView, \
LicenseDetailView, ArchChoiceView, LicensesListView, \
- LocalUseListView
+ LocalUseListView, FilteringView
urlpatterns = patterns('',
url(r'^categories/$', CategoriesListView.as_view(), name = 'categories'),
@@ -29,4 +29,5 @@ urlpatterns = patterns('',
url(r'^license/(?P<slug>[^/]+)/$', LicenseDetailView.as_view(), name = 'license'),
url(r'^arches/$', ArchChoiceView.as_view(), name = 'archchoice'),
url(r'^licenses/$', LicensesListView.as_view(), name = 'licenses'),
+ url(r'^filter/$', FilteringView.as_view(), name = 'filter'),
)
diff --git a/gpackages/apps/packages/views.py b/gpackages/apps/packages/views.py
index a52e3fa..ad1bffa 100644
--- a/gpackages/apps/packages/views.py
+++ b/gpackages/apps/packages/views.py
@@ -5,7 +5,8 @@ from .models import CategoryModel, HerdsModel, MaintainerModel, \
RepositoryModel, LicenseGroupModel, EbuildModel, \
PackageModel, UseFlagModel, PortageNewsModel, \
UseFlagDescriptionModel, LicenseModel
-from .forms import ArchChoiceForm
+from .forms import ArchChoiceForm, FilteringForm
+from django.core.urlresolvers import reverse
from django.shortcuts import get_object_or_404
from package_info.parse_cp import EbuildParseCPVR, PackageParseCPR
@@ -115,7 +116,7 @@ class PackagesListsView(MultipleFilterListViewMixin, ContextArchListView):
'rand':'?', # it slow
None: '-updated_datetime'
}
- allowed_many = {'repo': 5, 'use' : 3}
+ allowed_many = {'repo': 5, 'use' : 3, 'herd': 4, 'category': 4, 'license': 3}
paginate_by = 40
extra_context = {'page_name': 'Packages', 'arches': arches}
@@ -221,3 +222,26 @@ class ArchChoiceView(ContextView, ArchesViewMixin, FormView):
# arches_str = ','.join(arches)
self.request.session['arches'] = arches
return super(ArchChoiceView, self).form_valid(form)
+
+class FilteringView(FormView):
+ form_class = FilteringForm
+ template_name = 'filtering_view.html'
+ success_url = '/'
+ params_dict = { 'repos': 'repo',
+ 'herds': 'herd',
+ 'categories': 'category',
+ 'licenses': 'license',
+ 'uses': 'use'
+ }
+
+ def form_valid(self, form):
+ self.form_data = form.cleaned_data
+ return super(FilteringView, self).form_valid(form)
+
+ def get_success_url(self):
+ dct = {}
+ for k, v in self.params_dict.iteritems():
+ vv = self.form_data[k]
+ if vv:
+ dct[v] = ','.join(vv)
+ return reverse('packages', kwargs = dct)
diff --git a/gpackages/templates/base.html b/gpackages/templates/base.html
index 2f3c79a..cd90352 100644
--- a/gpackages/templates/base.html
+++ b/gpackages/templates/base.html
@@ -116,6 +116,7 @@
{% active_link 'local_uses' 'Local Use Flags' %}
{% active_link 'archchoice' 'Select Arches' %}
{% active_link 'licenses' 'Licenses' %}
+ {% active_link 'filter' 'Filter' %}
</ul>
</div>
{% recent_ebuilds %}
diff --git a/gpackages/templates/filtering_view.html b/gpackages/templates/filtering_view.html
new file mode 100644
index 0000000..d7a2f14
--- /dev/null
+++ b/gpackages/templates/filtering_view.html
@@ -0,0 +1,19 @@
+{% extends 'base.html' %}
+
+{% block content %}
+<div class="filter">
+<form action="./" method="post" enctype="multipart/form-data">{% csrf_token %}
+ {{ form.as_ul }} <br />
+ <input type="submit" value="Submit" />
+</form>
+</div>
+{% endblock content %}
+
+{% block scripts %}
+ {{ block.super }}
+ <link href="{{ STATIC_URL }}css/chosen.css" rel="stylesheet">
+ <script src="{{ STATIC_URL }}js/chosen.jquery.js"></script>
+ <script type="text/javascript" charset="utf-8">
+ $('select').chosen(); // :)
+ </script>
+{% endblock scripts %}
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-07-12 22:16 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-07-12 22:16 UTC (permalink / raw
To: gentoo-commits
commit: 24e1a01732de9e5486df0e5f4cd5f470239b8066
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Thu Jul 12 16:54:09 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Thu Jul 12 16:54:09 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=24e1a017
Add more stats for RepositoryModel
---
gpackages/apps/packages/models.py | 2 ++
gpackages/templates/repository.html | 8 ++++++++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/gpackages/apps/packages/models.py b/gpackages/apps/packages/models.py
index ee6e278..35d8b90 100644
--- a/gpackages/apps/packages/models.py
+++ b/gpackages/apps/packages/models.py
@@ -100,6 +100,8 @@ class RepositoryModel(StatsModel, AbstractDateTimeModel):
stats_params = (
('packages_count', 'packagemodel'),
+ ('maintainers_count', 'packagemodel__maintainers'),
+ ('categories_count', 'packagemodel__virtual_package__category'),
('ebuilds_count', 'packagemodel__ebuildmodel'),
)
diff --git a/gpackages/templates/repository.html b/gpackages/templates/repository.html
index 9f458cd..3c22d99 100644
--- a/gpackages/templates/repository.html
+++ b/gpackages/templates/repository.html
@@ -61,6 +61,14 @@
</thead>
<tbody>
<tr>
+ <td class="nowrap">Categories Count</td>
+ <td>{{ repository.categories_count }}</td>
+ </tr>
+ <tr>
+ <td class="nowrap">Maintainers Count</td>
+ <td>{{ repository.maintainers_count }}</td>
+ </tr>
+ <tr>
<td class="nowrap">Packages Count</td>
<td>{{ repository.packages_count }}</td>
</tr>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-07-12 22:16 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-07-12 22:16 UTC (permalink / raw
To: gentoo-commits
commit: 504d0c5a41992ec4018d55b01167af17a8bfee21
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Thu Jul 12 19:38:55 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Thu Jul 12 20:55:51 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=504d0c5a
Extend arhc choice view
---
gpackages/apps/packages/widgets.py | 11 ++++++++---
gpackages/templates/arch_choice.html | 9 +++++++--
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/gpackages/apps/packages/widgets.py b/gpackages/apps/packages/widgets.py
index 5059601..9bc303d 100644
--- a/gpackages/apps/packages/widgets.py
+++ b/gpackages/apps/packages/widgets.py
@@ -1,3 +1,4 @@
+from __future__ import absolute_import, unicode_literals
from django import forms
from django.utils.safestring import mark_safe
from django.utils.encoding import smart_unicode, force_unicode
@@ -39,9 +40,13 @@ class DivCheckboxSelectMultiple(forms.CheckboxSelectMultiple):
row2.append('</div>')
output.extend(row1 + row2)
output.append('</div>')
- output.append('<input type="button" id="reset" value="Reset" />')
- output.append('<input type="button" id="set" value="Set" />')
- output.append('<input type="button" id="default" value="Default" />')
+ button_group = []
+ button_group.append('<div class="btn-group">')
+ button_group.append('<button type="button" class="btn" id="reset">Reset</button>')
+ button_group.append('<button type="button" class="btn" id="set">Set</button>')
+ button_group.append('<button type="button" class="btn" id="default">Default</button>')
+ button_group.append('</div>')
+ output.extend(button_group)
return mark_safe('\n'.join(output))
class Media:
diff --git a/gpackages/templates/arch_choice.html b/gpackages/templates/arch_choice.html
index 7af213f..0ebad07 100644
--- a/gpackages/templates/arch_choice.html
+++ b/gpackages/templates/arch_choice.html
@@ -7,8 +7,13 @@
</script>
<div class="arches">
<form action="./" method="post" enctype="multipart/form-data">{% csrf_token %}
- {{ form.as_ul }} <br />
- <input type="submit" value="Submit" />
+ {% if form.arches.errors %}
+ <div class="alert alert-error">
+ {{ form.arches.errors }}
+ </div>
+ {% endif %}
+ {{ form.arches }} <br />
+ <input type="submit" class="btn btn-primary" value="Submit" />
</form>
</div>
{% endblock content %}
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-07-19 23:50 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-07-19 23:50 UTC (permalink / raw
To: gentoo-commits
commit: 5f676d86124b2e93be99ecf91077b5acee2c5b9e
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Thu Jul 19 14:51:41 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Thu Jul 19 14:51:41 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=5f676d86
Show description from ebuild if package don't have description in metadata
---
gpackages/apps/packages/views.py | 1 -
gpackages/templates/package_object.html | 2 ++
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/gpackages/apps/packages/views.py b/gpackages/apps/packages/views.py
index be0ad02..cd209e4 100644
--- a/gpackages/apps/packages/views.py
+++ b/gpackages/apps/packages/views.py
@@ -136,7 +136,6 @@ class PackagesListsView(MultipleFilterListViewMixin, ContextArchListView):
select_related('virtual_package',
'virtual_package__category'). \
prefetch_related('repository', 'herds', 'maintainers')
- #prefetch_keywords(['sparc-solaris', 'sparc64-solaris'])
class PackageDetailView(ArchesContexView, DetailView):
template_name = 'package.html'
diff --git a/gpackages/templates/package_object.html b/gpackages/templates/package_object.html
index 189d9bd..e1518b1 100644
--- a/gpackages/templates/package_object.html
+++ b/gpackages/templates/package_object.html
@@ -7,6 +7,8 @@
</div>
{% if package.description %}
<div style="padding-bottom: 10px; margin 10px;">{{ package.description }}</div>
+ {% elif package.short_description %}
+ <div style="padding-bottom: 10px; margin 10px;">{{ package.short_description }}</div>
{% endif %}
{% render_keywords_table package arches %}
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-07-19 23:50 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-07-19 23:50 UTC (permalink / raw
To: gentoo-commits
commit: 4b7742dd3dccade48f332d3ae94c7267649a60c0
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Thu Jul 19 21:49:48 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Thu Jul 19 21:49:48 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=4b7742dd
Add homepages to package info
---
gpackages/apps/packages/views.py | 3 ++-
gpackages/templates/package_object.html | 14 ++++++++++++--
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/gpackages/apps/packages/views.py b/gpackages/apps/packages/views.py
index cd209e4..b7def3a 100644
--- a/gpackages/apps/packages/views.py
+++ b/gpackages/apps/packages/views.py
@@ -135,7 +135,8 @@ class PackagesListsView(MultipleFilterListViewMixin, ContextArchListView):
queryset = PackageModel.objects.all(). \
select_related('virtual_package',
'virtual_package__category'). \
- prefetch_related('repository', 'herds', 'maintainers')
+ prefetch_related('repository', 'herds',
+ 'maintainers', 'latest_ebuild__homepages')
class PackageDetailView(ArchesContexView, DetailView):
template_name = 'package.html'
diff --git a/gpackages/templates/package_object.html b/gpackages/templates/package_object.html
index e1518b1..bf84e19 100644
--- a/gpackages/templates/package_object.html
+++ b/gpackages/templates/package_object.html
@@ -12,8 +12,8 @@
{% endif %}
{% render_keywords_table package arches %}
- {% with herds=package.herds.all maintainers=package.maintainers.all %}
- {% if herds or maintainers %}
+ {% with herds=package.herds.all maintainers=package.maintainers.all homepages=package.latest_ebuild.homepages.all %}
+ {% if herds or maintainers or homepages %}
<div style="padding-bottom: 10px; padding-top: 0px; margin-top: 0px;">
<a href="#" class="trigger"><span class="trigger">+</span>Details</a>
</div>
@@ -44,6 +44,16 @@
</td>
</tr>
{% endif %}
+ {% if homepages %}
+ <tr>
+ <td>Homepages:</td>
+ <td>
+ {% for homepage in homepages %}
+ <a href="{{ homepage.url }}">{{ homepage.url }}</a>{% if not forloop.last %},{% endif %}
+ {% endfor %}
+ </td>
+ </tr>
+ {% endif %}
</tbody>
</table>
</div>
^ permalink raw reply related [flat|nested] 19+ messages in thread
* [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/
@ 2012-08-20 13:03 Slava Bacherikov
0 siblings, 0 replies; 19+ messages in thread
From: Slava Bacherikov @ 2012-08-20 13:03 UTC (permalink / raw
To: gentoo-commits
commit: c68e86fa7575e077c74f951a661e69ec310f8a7d
Author: Slava Bacherikov <slava <AT> bacher09 <DOT> org>
AuthorDate: Mon Aug 13 15:52:33 2012 +0000
Commit: Slava Bacherikov <slava <AT> bacherikov <DOT> org <DOT> ua>
CommitDate: Mon Aug 13 15:52:33 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoo-packages.git;a=commit;h=c68e86fa
Changes in maintainers template
---
gpackages/apps/packages/urls.py | 2 +-
gpackages/templates/maintainers.html | 3 +++
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/gpackages/apps/packages/urls.py b/gpackages/apps/packages/urls.py
index 5001bbb..c0207e9 100644
--- a/gpackages/apps/packages/urls.py
+++ b/gpackages/apps/packages/urls.py
@@ -12,7 +12,7 @@ urlpatterns = patterns('',
url(r'^herds/$', HerdsListView.as_view(), name = 'herds'),
url(r'^use/$', GlobalUseListView.as_view(), name = 'global_uses'),
url(r'^local_use/$', LocalUseListView.as_view(), name = 'local_uses'),
- url(r'^maintainers/$', MaintainersListView.as_view(), name = 'maintainers'),
+ url(r'^maintainers/{0}$'.format(MaintainersListView.get_url_part()), MaintainersListView.as_view(), name = 'maintainers'),
url(r'^repositories/$', RepositoriesListView.as_view(), name = 'repositories'),
url(r'^license-groups/$', LicenseGroupsView.as_view(), name = 'license_groups'),
url(r'^$', EbuildsListView.as_view(), name = 'ebuilds'),
diff --git a/gpackages/templates/maintainers.html b/gpackages/templates/maintainers.html
index 6e77b76..e09db72 100644
--- a/gpackages/templates/maintainers.html
+++ b/gpackages/templates/maintainers.html
@@ -9,11 +9,13 @@
<colgroup>
<col class="span3" >
<col class="span3" >
+ <col class="span2" >
</colgroup>
<thead>
<tr>
<th>Name</th>
<th>Email</th>
+ <th>Gentoo dev</th>
</tr>
</thead>
<tbody>
@@ -22,6 +24,7 @@
<td class="nowrap"><a href="{% url 'packages' maintainer=maintainer.pk %}">{{ maintainer.name|default:"Not represented" }}</a></td>
<!-- email should be obfuscated -->
<td class="nowrap"><a href="{{ 'mailto:'|add:maintainer.email|obfuscate }}">{{ maintainer.email|obfuscate }}</a></td>
+ <td>{% if maintainer.is_dev %}<span class="bool-ok">✔ Yes</span>{% else %}<span class="bool-no">✕ No</span>{% endif %}</td>
</tr>
{% endfor %}
</tbody>
^ permalink raw reply related [flat|nested] 19+ messages in thread
end of thread, other threads:[~2012-08-20 13:05 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-06 23:09 [gentoo-commits] proj/gentoo-packages:master commit in: gpackages/apps/packages/, gpackages/templates/ Slava Bacherikov
-- strict thread matches above, loose matches on Subject: below --
2012-08-20 13:03 Slava Bacherikov
2012-07-19 23:50 Slava Bacherikov
2012-07-19 23:50 Slava Bacherikov
2012-07-12 22:16 Slava Bacherikov
2012-07-12 22:16 Slava Bacherikov
2012-07-10 23:13 Slava Bacherikov
2012-07-08 19:54 Slava Bacherikov
2012-07-08 19:54 Slava Bacherikov
2012-07-08 19:54 Slava Bacherikov
2012-07-06 23:09 Slava Bacherikov
2012-07-04 22:13 Slava Bacherikov
2012-07-02 22:25 Slava Bacherikov
2012-06-30 21:02 Slava Bacherikov
2012-06-30 21:02 Slava Bacherikov
2012-06-30 0:22 Slava Bacherikov
2012-06-29 19:25 Slava Bacherikov
2012-06-28 23:59 Slava Bacherikov
2012-06-27 22:52 Slava Bacherikov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox