# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.shortcuts import render from django.contrib.auth.decorators import login_required from .models import Item, Loan @login_required def loan_list(request): view = 'old' if 'old' in request.GET else '' if view == 'old': loans = request.user.loans.finished().order_by('-loan_date_end') else: loans = request.user.loans.running() return render(request, 'hardware_provisioning/list.html', { 'loans': loans, 'view': view, }) @login_required def loan_detail(request, pk): return render(request, 'hardware_provisioning/detail.html', {})