euscanwww: update style, prefetch related, ...

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
This commit is contained in:
Corentin Chary
2012-03-05 14:46:34 +01:00
parent 1d65ee1984
commit 043197a3be
18 changed files with 126 additions and 60 deletions

View File

@ -115,7 +115,7 @@ class Command(BaseCommand):
package.n_packaged = n_packaged.get(package.id, 0)
package.n_overlay = n_overlay.get(package.id, 0)
default = {'id' : -1}
default = {'id' : None}
package.last_version_gentoo_id = last_versions_gentoo.get(package.id, default)['id']
package.last_version_overlay_id = last_versions_overlay.get(package.id, default)['id']
package.last_version_upstream_id = last_versions_upstream.get(package.id, default)['id']

View File

@ -2,14 +2,17 @@ from django import template
register = template.Library()
@register.inclusion_tag('euscan/_packages.html')
def packages(packages):
return { 'packages' : packages }
@register.inclusion_tag('euscan/_packages.html', takes_context=True)
def packages(context, packages):
context['packages'] = packages
return context
@register.inclusion_tag('euscan/_package_cols.html')
def package_cols(infos):
return { 'infos' : infos }
@register.inclusion_tag('euscan/_package_cols.html', takes_context=True)
def package_cols(context, infos):
context['infos'] = infos
return context
@register.inclusion_tag('euscan/_package_bar.html')
def package_bar(infos):
return { 'infos' : infos }
@register.inclusion_tag('euscan/_package_bar.html', takes_context=True)
def package_bar(context, infos):
context['infos'] = infos
return context

View File

@ -20,7 +20,12 @@ def index(request):
ctx['n_packages'] = Package.objects.count()
ctx['n_herds'] = Herd.objects.count()
ctx['n_maintainers'] = Maintainer.objects.count()
ctx['last_scan'] = EuscanResult.objects.get(id=EuscanResult.objects.aggregate(Max('id'))['id__max']).datetime
try:
ctx['last_scan'] = EuscanResult.objects.get(id=EuscanResult.objects.aggregate(Max('id'))['id__max']).datetime
except EuscanResult.DoesNotExist:
ctx['last_scan'] = None
return ctx
@render_to('euscan/logs.html')
@ -37,7 +42,8 @@ def categories(request):
@render_to('euscan/category.html')
def category(request, category):
packages = Package.objects.filter(category=category).select_related('last_version_gentoo', 'last_version_overlay', 'last_version_upstream')
packages = Package.objects.filter(category=category)
packages = packages.select_related('last_version_gentoo', 'last_version_overlay', 'last_version_upstream')
print dir(packages[0])
if not packages:
raise Http404
@ -56,6 +62,7 @@ def herds(request):
def herd(request, herd):
herd = get_object_or_404(Herd, herd=herd)
packages = Package.objects.filter(herds__id=herd.id)
packages = packages.select_related('last_version_gentoo', 'last_version_overlay', 'last_version_upstream')
return { 'herd' : herd, 'packages' : packages }
@render_to('euscan/maintainers.html')
@ -72,6 +79,7 @@ def maintainers(request):
def maintainer(request, maintainer_id):
maintainer = get_object_or_404(Maintainer, id=maintainer_id)
packages = Package.objects.filter(maintainers__id=maintainer.id)
packages = packages.select_related('last_version_gentoo', 'last_version_overlay', 'last_version_upstream')
return { 'maintainer' : maintainer, 'packages' : packages }
@render_to('euscan/overlays.html')

View File

@ -78,7 +78,7 @@ a:hover, a:active
.menu {
width:100%;
margin-top: 75px;
margin-top: 30px;
background: #8076A1;
color: #FFF;
}
@ -195,6 +195,7 @@ td
th
{
font-size: 0.8em;
text-align: center;
border-bottom: 3px solid;
}

BIN
euscanwww/media/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 916 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 558 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 B

View File

@ -42,7 +42,7 @@
<li>---</li>
{% block menu_feed %}
<li>
<img src="{{ MEDIA_URL }}/img/feed.png" alt="feed" />
<img src="{{ MEDIA_URL }}img/feed.png" alt="feed" />
<a title="Global Feed" href="{% url global_feed %}">Global Feed</a>
</li>
{% endblock %}

View File

@ -21,3 +21,15 @@
});
</script>
{% endblock %}
{% block menus %}
{{ block.super }}
<div class="menu">
<ul>
<li><img src="{{ MEDIA_URL }}img/gentoo-icon.png" /> Gentoo</li>
<li><img src="{{ MEDIA_URL }}img/overlay-icon.png" /> Overlays</li>
<li><img src="{{ MEDIA_URL }}img/upstream-icon.png" /> Upstream</li>
<li><img src="{{ MEDIA_URL }}img/freshness-icon.png" /> Freshness</li>
</ul>
</div>
{% endblock %}

View File

@ -6,13 +6,13 @@
<table id="table" class="display">
<thead>
<th>Package</th>
<th>Gentoo</th>
<th>Overlay</th>
<th>Upstream</th>
<th>Gentoo</th>
<th>Overlays</th>
<th>Unpackaged</th>
<th>Freshness</th>
<th><img src="{{ MEDIA_URL }}img/gentoo-icon.png" alt="gentoo" title="Last version in Gentoo" /></th>
<th><img src="{{ MEDIA_URL }}img/overlay-icon.png" alt="overlays" title="Last version in Overlays" /></th>
<th><img src="{{ MEDIA_URL }}img/upstream-icon.png" alt="upstream" title="Last version Upstream" /></th>
<th><img src="{{ MEDIA_URL }}img/gentoo-icon.png" alt="gentoo" title="Versions in Gentoo" /></th>
<th><img src="{{ MEDIA_URL }}img/overlay-icon.png" alt="overlays" title="Versions in Overlays" /></th>
<th><img src="{{ MEDIA_URL }}img/upstream-icon.png" alt="upstream" title="Versions only upstream" /></th>
<th><img src="{{ MEDIA_URL }}img/freshness-icon.png" title="Freshness" /></th>
</thead>
<tbody>
{% for package in packages %}

View File

@ -12,7 +12,7 @@
<li><a href="{% url api.views.categories 'json' %}">/api/1.0/categories.json</a></li>
<li>/api/1.0/packages/by-maintainer/&lt;maintainer-id&gt;.json</li>
<li>/api/1.0/packages/by-category/&lt;category&gt;.json</li>
<li>/api/1.0/packages/by-herds/&lt;herd&gt;.json</li>
<li>/api/1.0/packages/by-herd/&lt;herd&gt;.json</li>
<li>/api/1.0/package/&lt;category&gt;/&lt;package&gt;.json</li>
</ul>

View File

@ -12,10 +12,10 @@
<table id="table" class="display">
<thead>
<th>Category</th>
<th>Gentoo</th>
<th>Overlays</th>
<th>Unpackaged</th>
<th>Freshness</th>
<th><img src="{{ MEDIA_URL }}img/gentoo-icon.png" alt="gentoo" title="Versions in Gentoo" /></th>
<th><img src="{{ MEDIA_URL }}img/overlay-icon.png" alt="overlays" title="Versions in Overlays" /></th>
<th><img src="{{ MEDIA_URL }}img/upstream-icon.png" alt="upstream" title="Versions only upstream" /></th>
<th><img src="{{ MEDIA_URL }}img/freshness-icon.png" title="Freshness" /></th>
{% if request.GET.extras %}
<th>Graphs</th>
{% endif %}

View File

@ -11,10 +11,10 @@
<table id="table" class="display">
<thead>
<th>Herd</th>
<th>Gentoo</th>
<th>Overlays</th>
<th>Unpackaged</th>
<th>Freshness</th>
<th><img src="{{ MEDIA_URL }}img/gentoo-icon.png" alt="gentoo" title="Versions in Gentoo" /></th>
<th><img src="{{ MEDIA_URL }}img/overlay-icon.png" alt="overlays" title="Versions in Overlays" /></th>
<th><img src="{{ MEDIA_URL }}img/upstream-icon.png" alt="upstream" title="Versions only upstream" /></th>
<th><img src="{{ MEDIA_URL }}img/freshness-icon.png" title="Freshness" /></th>
{% if request.GET.extras %}
<th>Graphs</th>
{% endif %}

View File

@ -11,10 +11,10 @@
<table id="table" class="display">
<thead>
<th>Maintainer</th>
<th>Gentoo</th>
<th>Overlays</th>
<th>Unpackaged</th>
<th>Freshness</th>
<th><img src="{{ MEDIA_URL }}img/gentoo-icon.png" alt="gentoo" title="Versions in Gentoo" /></th>
<th><img src="{{ MEDIA_URL }}img/overlay-icon.png" alt="overlays" title="Versions in Overlays" /></th>
<th><img src="{{ MEDIA_URL }}img/upstream-icon.png" alt="upstream" title="Versions only upstream" /></th>
<th><img src="{{ MEDIA_URL }}img/freshness-icon.png" title="Freshness" /></th>
{% if request.GET.extras %}
<th>Graphs</th>
{% endif %}