Simplify transfer view
This commit is contained in:
parent
931b2c4e1f
commit
2aa06d2954
2 changed files with 4 additions and 13 deletions
|
@ -252,7 +252,7 @@ urlpatterns = [
|
|||
# -----
|
||||
# Transfers urls
|
||||
# -----
|
||||
path("transfers/", views.transfers, name="kfet.transfers"),
|
||||
path("transfers/", views.TransferView.as_view(), name="kfet.transfers"),
|
||||
path("transfers/new", views.transfers_create, name="kfet.transfers.create"),
|
||||
path("transfers/perform", views.perform_transfers, name="kfet.transfers.perform"),
|
||||
path("transfers/cancel", views.cancel_transfers, name="kfet.transfers.cancel"),
|
||||
|
|
|
@ -1598,18 +1598,9 @@ config_update = permission_required("kfet.change_config")(SettingsUpdate.as_view
|
|||
# -----
|
||||
|
||||
|
||||
@teamkfet_required
|
||||
def transfers(request):
|
||||
transfers_pre = Prefetch(
|
||||
"transfers", queryset=(Transfer.objects.select_related("from_acc", "to_acc"))
|
||||
)
|
||||
|
||||
transfergroups = (
|
||||
TransferGroup.objects.select_related("valid_by")
|
||||
.prefetch_related(transfers_pre)
|
||||
.order_by("-at")
|
||||
)
|
||||
return render(request, "kfet/transfers.html", {"transfergroups": transfergroups})
|
||||
@method_decorator(teamkfet_required, name="dispatch")
|
||||
class TransferView(TemplateView):
|
||||
template_name = "kfet/transfers.html"
|
||||
|
||||
|
||||
@teamkfet_required
|
||||
|
|
Loading…
Reference in a new issue