[QRTR-110] Added Filtering options, and adjusted for Django 3.2 updates.

This commit is contained in:
DJ Gillespie 2021-05-17 20:13:31 -06:00
parent e19e0fe659
commit d00fb4b5a1
3 changed files with 14 additions and 2 deletions

View File

@ -47,6 +47,7 @@ INSTALLED_APPS = [
'qrtr_account', 'qrtr_account',
'corsheaders', 'corsheaders',
'rest_framework_simplejwt.token_blacklist', 'rest_framework_simplejwt.token_blacklist',
'django_filters',
] ]
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
@ -92,6 +93,7 @@ TEMPLATES = [
WSGI_APPLICATION = 'core.wsgi.application' WSGI_APPLICATION = 'core.wsgi.application'
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
# Database # Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases # https://docs.djangoproject.com/en/2.2/ref/settings/#databases
@ -102,7 +104,10 @@ REST_FRAMEWORK = {
'rest_framework.authentication.SessionAuthentication', 'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.TokenAuthentication', 'rest_framework.authentication.TokenAuthentication',
'dj_rest_auth.jwt_auth.JWTCookieAuthentication' 'dj_rest_auth.jwt_auth.JWTCookieAuthentication'
] ],
'DEFAULT_FILTER_BACKENDS': (
'django_filters.rest_framework.DjangoFilterBackend',
)
} }
REST_USE_JWT = True REST_USE_JWT = True

View File

@ -2,4 +2,4 @@ from django.apps import AppConfig
class QrtrAccountConfig(AppConfig): class QrtrAccountConfig(AppConfig):
name = 'QRTR Account' name = 'qrtr_account'

View File

@ -67,6 +67,13 @@ class TransactionViewSet(viewsets.ModelViewSet):
queryset = Transaction.objects.all() queryset = Transaction.objects.all()
serializer_class = TransactionSerializer serializer_class = TransactionSerializer
filterset_fields = {
'authorized_date': ['exact', 'lte', 'gte', 'isnull'],
'updated_at': ['exact', 'lte', 'gte', 'isnull'],
'created_at': ['exact', 'lte', 'gte', 'isnull'],
'trans_id': ['exact', 'lte', 'gte', 'isnull'],
}
class RuleViewSet(viewsets.ReadOnlyModelViewSet): class RuleViewSet(viewsets.ReadOnlyModelViewSet):
"""API endpoint that allows Banks to be viewed. """API endpoint that allows Banks to be viewed.