| 123456789101112131415 |
- class TransactionsMixin:
- """
- TransactionMixin are essentially just a type of class mixin
- when define common functions for all Viewsets
- """
- def get_filtered_transactions(self):
- date_from = self.request.query_params.get('date_from', None)
- date_to = self.request.query_params.get('date_from', None)
- transactions = self.user.transactions
- if date_from:
- transactions = transactions.filter(date__gte=date_from)
- if date_to:
- transactions = transactions.filter(date__lte=date_to)
- return transactions
|