diff --git a/nummi/main/views.py b/nummi/main/views.py index aec332b..73a3c74 100644 --- a/nummi/main/views.py +++ b/nummi/main/views.py @@ -241,15 +241,7 @@ class AccountMixin: } -class AccountTListView(AccountMixin, TransactionListView): - pass - - -class AccountSListView(AccountMixin, SnapshotListView): - pass - - -class SnapshotTListView(TransactionListView): +class SnapshotMixin: def get_queryset(self): return super().get_queryset().filter(snapshot=self.kwargs.get("pk")) @@ -259,7 +251,7 @@ class SnapshotTListView(TransactionListView): } -class CategoryTListView(TransactionListView): +class CategoryMixin: def get_queryset(self): return super().get_queryset().filter(category=self.kwargs.get("pk")) @@ -269,6 +261,22 @@ class CategoryTListView(TransactionListView): } +class AccountTListView(AccountMixin, TransactionListView): + pass + + +class AccountSListView(AccountMixin, SnapshotListView): + pass + + +class SnapshotTListView(SnapshotMixin, TransactionListView): + pass + + +class CategoryTListView(CategoryMixin, TransactionListView): + pass + + class SearchView(TransactionListView): def post(self, *args, **kwargs): return redirect("search", search=self.request.POST.get("search"))