Adds ability for staff to extend a user’s reservations
This commit is contained in:
parent
d31d812001
commit
6dbc303e7c
3 changed files with 25 additions and 0 deletions
|
@ -15,6 +15,7 @@ from django.db.models import Case, When, Value
|
||||||
from django.db.models.fields.related import RelatedField
|
from django.db.models.fields.related import RelatedField
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
|
|
||||||
|
from registrasion.controllers.cart import CartController
|
||||||
from registrasion.controllers.item import ItemController
|
from registrasion.controllers.item import ItemController
|
||||||
from registrasion.models import commerce
|
from registrasion.models import commerce
|
||||||
from registrasion.models import people
|
from registrasion.models import people
|
||||||
|
@ -417,6 +418,10 @@ def attendee(request, form, user_id=None):
|
||||||
value = getattr(profile, field.name)
|
value = getattr(profile, field.name)
|
||||||
profile_data.append((field.verbose_name, value))
|
profile_data.append((field.verbose_name, value))
|
||||||
|
|
||||||
|
cart = CartController.for_user(attendee.user)
|
||||||
|
reservation = cart.cart.reservation_duration + cart.cart.time_last_updated
|
||||||
|
profile_data.append(("Current cart reserved until", reservation))
|
||||||
|
|
||||||
reports.append(ListReport("Profile", ["", ""], profile_data))
|
reports.append(ListReport("Profile", ["", ""], profile_data))
|
||||||
|
|
||||||
links = []
|
links = []
|
||||||
|
@ -424,6 +429,11 @@ def attendee(request, form, user_id=None):
|
||||||
reverse(views.amend_registration, args=[user_id]),
|
reverse(views.amend_registration, args=[user_id]),
|
||||||
"Amend current cart",
|
"Amend current cart",
|
||||||
))
|
))
|
||||||
|
links.append((
|
||||||
|
reverse(views.extend_reservation, args=[user_id]),
|
||||||
|
"Extend reservation",
|
||||||
|
))
|
||||||
|
|
||||||
reports.append(Links("Actions for " + name, links))
|
reports.append(Links("Actions for " + name, links))
|
||||||
|
|
||||||
# Paid and pending products
|
# Paid and pending products
|
||||||
|
|
|
@ -8,6 +8,7 @@ from .views import (
|
||||||
checkout,
|
checkout,
|
||||||
credit_note,
|
credit_note,
|
||||||
edit_profile,
|
edit_profile,
|
||||||
|
extend_reservation,
|
||||||
guided_registration,
|
guided_registration,
|
||||||
invoice,
|
invoice,
|
||||||
invoice_access,
|
invoice_access,
|
||||||
|
@ -24,6 +25,7 @@ public = [
|
||||||
url(r"^checkout$", checkout, name="checkout"),
|
url(r"^checkout$", checkout, name="checkout"),
|
||||||
url(r"^checkout/([0-9]+)$", checkout, name="checkout"),
|
url(r"^checkout/([0-9]+)$", checkout, name="checkout"),
|
||||||
url(r"^credit_note/([0-9]+)$", credit_note, name="credit_note"),
|
url(r"^credit_note/([0-9]+)$", credit_note, name="credit_note"),
|
||||||
|
url(r"^extend/([0-9]+)$", extend_reservation, name="extend_reservation"),
|
||||||
url(r"^invoice/([0-9]+)$", invoice, name="invoice"),
|
url(r"^invoice/([0-9]+)$", invoice, name="invoice"),
|
||||||
url(r"^invoice/([0-9]+)/([A-Z0-9]+)$", invoice, name="invoice"),
|
url(r"^invoice/([0-9]+)/([A-Z0-9]+)$", invoice, name="invoice"),
|
||||||
url(r"^invoice/([0-9]+)/manual_payment$",
|
url(r"^invoice/([0-9]+)/manual_payment$",
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import datetime
|
||||||
import sys
|
import sys
|
||||||
import util
|
import util
|
||||||
|
|
||||||
|
@ -903,3 +904,15 @@ def amend_registration(request, user_id):
|
||||||
}
|
}
|
||||||
|
|
||||||
return render(request, "registrasion/amend_registration.html", data)
|
return render(request, "registrasion/amend_registration.html", data)
|
||||||
|
|
||||||
|
|
||||||
|
@user_passes_test(_staff_only)
|
||||||
|
def extend_reservation(request, user_id, days=7):
|
||||||
|
''' Allows staff to extend the reservation on a given user's cart.
|
||||||
|
'''
|
||||||
|
|
||||||
|
user = User.objects.get(id=int(user_id))
|
||||||
|
cart = CartController.for_user(user)
|
||||||
|
cart.extend_reservation(datetime.timedelta(days=days))
|
||||||
|
|
||||||
|
return redirect(request.META["HTTP_REFERER"])
|
||||||
|
|
Loading…
Reference in a new issue