Fixes: (1) Removed all `# type: ignore` annotations across the codebase; (2) Fixed usage of Django Model methods by eliminating unnecessary `# type: ignore` directives; (3) Adjusted usage of functions like `get()` to align with method expectations, removing incorrect comments; Extra: (1) Deleted `pyrightconfig.json` as part of migration to a stricter type-checked environment; (2) Minor code cleanup, including formatting changes and refactoring import statements in adherence to PEP8 recommendations.
25 lines
1.1 KiB
Python
25 lines
1.1 KiB
Python
from django.utils.translation import gettext_lazy as _
|
|
from drf_spectacular.utils import extend_schema_view
|
|
from rest_framework.viewsets import ReadOnlyModelViewSet
|
|
|
|
from engine.core.permissions import EvibesPermission, IsOwner
|
|
from engine.payments.docs.drf.viewsets import TRANSACTION_SCHEMA
|
|
from engine.payments.models import Transaction
|
|
from engine.payments.serializers import TransactionSerializer
|
|
|
|
|
|
@extend_schema_view(**TRANSACTION_SCHEMA)
|
|
class TransactionViewSet(ReadOnlyModelViewSet):
|
|
__doc__ = _(
|
|
"ViewSet for handling read-only operations on the Transaction model. "
|
|
"This class provides a read-only interface for interacting with transaction data. "
|
|
"It uses the TransactionSerializer for serializing and deserializing "
|
|
"the data. The class ensures that only authorized users, who meet specific "
|
|
"permissions, can access the transactions."
|
|
)
|
|
|
|
queryset = Transaction.objects.all()
|
|
lookup_field = "uuid"
|
|
lookup_url_kwarg = "uuid"
|
|
serializer_class = TransactionSerializer
|
|
permission_classes = (EvibesPermission, IsOwner)
|