fixup backoffice handout view a bit

This commit is contained in:
Thomas Steen Rasmussen 2017-12-04 10:43:25 +01:00
parent 6a082e6b58
commit 74729ade14
2 changed files with 5 additions and 7 deletions

View file

@ -26,18 +26,16 @@
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{% for order in order_list %} {% for productrel in orderproductrelation_list %}
{% for productrel in order.orderproductrelation_set.all %}
<tr> <tr>
<td><a href="/admin/shop/order/{{ order.id }}/change/">Order #{{ order.id }}</a></td> <td><a href="/admin/shop/order/{{ productrel.order.id }}/change/">Order #{{ productrel.order.id }}</a></td>
<td>{{ order.user }}</td> <td>{{ productrel.order.user }}</td>
<td>{{ productrel.id }}</td> <td>{{ productrel.id }}</td>
<td>{{ productrel.product.name }}</td> <td>{{ productrel.product.name }}</td>
<td>{{ productrel.quantity }}</td> <td>{{ productrel.quantity }}</td>
<td>{{ productrel.handed_out }}</td> <td>{{ productrel.handed_out }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
{% endfor %}
</tbody> </tbody>
</table> </table>
</div> </div>

View file

@ -4,7 +4,7 @@ from django.views import View
from django.conf import settings from django.conf import settings
from django.utils.decorators import method_decorator from django.utils.decorators import method_decorator
from django.http import HttpResponseForbidden from django.http import HttpResponseForbidden
from shop.models import Order from shop.models import OrderProductRelation
import logging import logging
logger = logging.getLogger("bornhack.%s" % __name__) logger = logging.getLogger("bornhack.%s" % __name__)
@ -22,5 +22,5 @@ class BackofficeIndexView(StaffMemberRequiredMixin, TemplateView):
class InfodeskView(StaffMemberRequiredMixin, ListView): class InfodeskView(StaffMemberRequiredMixin, ListView):
template_name = "infodesk.html" template_name = "infodesk.html"
queryset = Order.objects.filter(paid=True, cancelled=False, refunded=False, orderproductrelation__handed_out=False).distinct() queryset = OrderProductRelation.objects.filter(handed_out=False, order__paid=True, order__refunded=False, order__cancelled=False).order_by("'order')