Commit cf928f25 authored by Laurent Peuch's avatar Laurent Peuch
Browse files

[enh] display current stock on dashboard

parent 380fc1ba
......@@ -14,12 +14,33 @@
Group Orders
-for group_order in object_list
-for group_order in group_orders
%a{href: "{% url 'admin2_group_order_detail' %}"}=
%col{width: "10px"}
%col{width: "10px"}
%th Name
%th Stock
%th Price
-for component in components
%a{href: "{{ component.url }}"}= component.reference
%td= component.stock
%td= component.current_price
......@@ -8,6 +8,6 @@ from . import views
urlpatterns = patterns('admin2.views',
url(r'^$', user_is_admin(ListView.as_view(template_name="admin2/home.haml", queryset=GroupOrder.objects.order_by("-launched_on"))), name='admin2_home'),
url(r'^$', user_is_admin(views.dashboard), name='admin2_home'),
url(r'^group_order/(?P<pk>\d+)/$', user_is_admin(views.group_order_detail), name='admin2_group_order_detail'),
......@@ -4,6 +4,13 @@ from django.db.models import Sum
from ordering.models import Component, GroupOrder
def dashboard(request):
return render(request, "admin2/home.haml", {
"group_orders": GroupOrder.objects.all().order_by("-launched_on"),
"components": Component.objects.all().order_by("full_name"),
def group_order_detail(request, pk):
group_order = get_object_or_404(GroupOrder, pk=pk)
orders = group_order.order_set.all()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment