Fix monthly view for category and account
This commit is contained in:
parent
17e150032e
commit
0e1c1be189
1 changed files with 10 additions and 10 deletions
|
@ -444,24 +444,24 @@ class TransactionMonthView(UserMixin, MonthArchiveView):
|
||||||
category = None
|
category = None
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
if self.account:
|
if "account" in self.kwargs:
|
||||||
|
self.account = get_object_or_404(
|
||||||
|
Account.objects.filter(user=self.request.user),
|
||||||
|
pk=self.kwargs["account"],
|
||||||
|
)
|
||||||
return super().get_queryset().filter(account=self.account)
|
return super().get_queryset().filter(account=self.account)
|
||||||
if self.category:
|
if "category" in self.kwargs:
|
||||||
|
self.category = get_object_or_404(
|
||||||
|
Category.objects.filter(user=self.request.user),
|
||||||
|
pk=self.kwargs["category"],
|
||||||
|
)
|
||||||
return super().get_queryset().filter(category=self.category)
|
return super().get_queryset().filter(category=self.category)
|
||||||
|
|
||||||
return super().get_queryset()
|
return super().get_queryset()
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
if "account" in self.kwargs:
|
if "account" in self.kwargs:
|
||||||
self.account = get_object_or_404(
|
|
||||||
Account.objects.filter(user=self.request.user),
|
|
||||||
pk=self.kwargs["account"],
|
|
||||||
)
|
|
||||||
return super().get_context_data(**kwargs) | {"account": self.account}
|
return super().get_context_data(**kwargs) | {"account": self.account}
|
||||||
if "category" in self.kwargs:
|
if "category" in self.kwargs:
|
||||||
self.category = get_object_or_404(
|
|
||||||
Category.objects.filter(user=self.request.user),
|
|
||||||
pk=self.kwargs["category"],
|
|
||||||
)
|
|
||||||
return super().get_context_data(**kwargs) | {"category": self.category}
|
return super().get_context_data(**kwargs) | {"category": self.category}
|
||||||
return super().get_context_data(**kwargs)
|
return super().get_context_data(**kwargs)
|
||||||
|
|
Loading…
Reference in a new issue