Update snapshot page
This commit is contained in:
parent
a14f73779b
commit
ab3f7f4e40
1 changed files with 2 additions and 6 deletions
|
@ -280,15 +280,10 @@ class SnapshotUpdateView(NummiUpdateView):
|
||||||
form_class = SnapshotForm
|
form_class = SnapshotForm
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
_max = 8
|
|
||||||
data = super().get_context_data(**kwargs)
|
data = super().get_context_data(**kwargs)
|
||||||
snapshot = data["form"].instance
|
snapshot = data["form"].instance
|
||||||
|
|
||||||
_transactions = snapshot.transaction_set.all()
|
_transactions = snapshot.transaction_set.all()
|
||||||
if _transactions.count() > _max:
|
|
||||||
data["transactions_url"] = reverse_lazy(
|
|
||||||
"snapshot_transactions", args=(snapshot.pk,)
|
|
||||||
)
|
|
||||||
if _transactions:
|
if _transactions:
|
||||||
_categories = (
|
_categories = (
|
||||||
_transactions.values("category", "category__name", "category__icon")
|
_transactions.values("category", "category__name", "category__icon")
|
||||||
|
@ -310,10 +305,11 @@ class SnapshotUpdateView(NummiUpdateView):
|
||||||
}
|
}
|
||||||
|
|
||||||
return data | {
|
return data | {
|
||||||
|
"account": snapshot.account,
|
||||||
"new_transaction_url": reverse_lazy(
|
"new_transaction_url": reverse_lazy(
|
||||||
"transaction", kwargs={"snapshot": snapshot.pk}
|
"transaction", kwargs={"snapshot": snapshot.pk}
|
||||||
),
|
),
|
||||||
"transactions": _transactions[:_max],
|
"transactions": _transactions,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue