|
@@ -2,13 +2,13 @@
|
|
|
|
|
|
from __future__ import unicode_literals
|
|
from __future__ import unicode_literals
|
|
|
|
|
|
-import datetime
|
|
|
|
|
|
|
|
from django.shortcuts import get_object_or_404, render, redirect
|
|
from django.shortcuts import get_object_or_404, render, redirect
|
|
from django.contrib.auth.decorators import login_required
|
|
from django.contrib.auth.decorators import login_required
|
|
from django.contrib import messages
|
|
from django.contrib import messages
|
|
from django.http import HttpResponseForbidden
|
|
from django.http import HttpResponseForbidden
|
|
from django.core.urlresolvers import reverse
|
|
from django.core.urlresolvers import reverse
|
|
|
|
+from django.utils import timezone
|
|
|
|
|
|
from .forms import LoanDeclareForm, LoanTransferForm, LoanReturnForm
|
|
from .forms import LoanDeclareForm, LoanTransferForm, LoanReturnForm
|
|
from .models import Item, Loan
|
|
from .models import Item, Loan
|
|
@@ -37,7 +37,7 @@ def item_borrow(request, pk):
|
|
if form.is_valid():
|
|
if form.is_valid():
|
|
loan = Loan.objects.create(
|
|
loan = Loan.objects.create(
|
|
item=item,
|
|
item=item,
|
|
- loan_date=datetime.date.today(),
|
|
|
|
|
|
+ loan_date=timezone.now(),
|
|
loan_date_end=form.cleaned_data['loan_date_end'],
|
|
loan_date_end=form.cleaned_data['loan_date_end'],
|
|
user=request.user,
|
|
user=request.user,
|
|
)
|
|
)
|
|
@@ -98,7 +98,7 @@ def loan_transfer(request, pk):
|
|
old_loan.item.give_back()
|
|
old_loan.item.give_back()
|
|
Loan.objects.create(
|
|
Loan.objects.create(
|
|
user=form.cleaned_data['target_user'],
|
|
user=form.cleaned_data['target_user'],
|
|
- loan_date=datetime.date.today(),
|
|
|
|
|
|
+ loan_date=timezone.now(),
|
|
item=old_loan.item)
|
|
item=old_loan.item)
|
|
messages.success(
|
|
messages.success(
|
|
request,
|
|
request,
|