Homeseite mit sortierung was am liebsten getrunken wurde

This commit is contained in:
TKroenert 2011-03-05 02:29:16 +01:00
parent 769619310e
commit 7e5474ff16
3 changed files with 16 additions and 2 deletions

View File

@ -1,6 +1,7 @@
WTFs: WTFs:
[x] Kontostand beim kaufen auch veraendern.. [x] Kontostand beim kaufen auch veraendern..
[x] Einkaufshistory basteln [x] Einkaufshistory basteln
[ ] Beim einkaufen von Objekten ohne Deposit sollten es nicht moeglich sein diese "with Deposit" zu kaufen
Noch zu tun: Noch zu tun:
[ ] "Home" mit inhalt fuellen [ ] "Home" mit inhalt fuellen

View File

@ -1,5 +1,14 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block "content" %} {% block "content" %}
No content here. {% if usersMost %}
Am oeftesten hatten alle: <br /> <br />
{% for buyable in usersMost %}
{{ buyable.buyable__name }} ( {{ buyable.num_buys }} mal) <br />
{% endfor %}
<br />
{% else %}
{{ error }}
Nix gekauft?
{% endif %}
{% endblock %} {% endblock %}

View File

@ -1,10 +1,14 @@
from django.shortcuts import render_to_response from django.shortcuts import render_to_response
from django.template import RequestContext from django.template import RequestContext
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.db.models import Count
from buyable.models import Purchase, Buyable
@login_required @login_required
def startpage(request): def startpage(request):
return render_to_response("main/startpage.html", {}, RequestContext(request)) usersMost = Purchase.objects.values('buyable__name').annotate(num_buys=Count('buyable')).order_by('-num_buys')
return render_to_response("main/startpage.html", {'usersMost': usersMost}, RequestContext(request))
def register(request): def register(request):
return render_to_response("registration/register.html", RequestContext(request)) return render_to_response("registration/register.html", RequestContext(request))