From 9abf549ed43345c2a5765510ede81e15c3ba98af Mon Sep 17 00:00:00 2001 From: abutalib-kiwi Date: Wed, 8 Nov 2023 15:02:23 +0530 Subject: [PATCH 1/3] modified user notification setting, added optional value for sms notification as false --- account/serializers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/account/serializers.py b/account/serializers.py index e317c0c..03160b6 100644 --- a/account/serializers.py +++ b/account/serializers.py @@ -387,7 +387,7 @@ class UpdateUserNotificationSerializer(serializers.ModelSerializer): defaults={ 'push_notification': validated_data.get('push_notification'), 'email_notification': validated_data.get('email_notification'), - 'sms_notification': validated_data.get('sms_notification'), + 'sms_notification': validated_data.get('sms_notification', False), }) return instance From bdc92163c36fa7e08afd98524b7c1c5dcd38f337 Mon Sep 17 00:00:00 2001 From: abutalib-kiwi Date: Wed, 8 Nov 2023 18:47:28 +0530 Subject: [PATCH 2/3] added fixture file for faq's --- fixtures/faq.json | 112 ++++++++++++++++++++++++++++++++++++++++++++++ junior/views.py | 7 ++- 2 files changed, 118 insertions(+), 1 deletion(-) create mode 100644 fixtures/faq.json diff --git a/fixtures/faq.json b/fixtures/faq.json new file mode 100644 index 0000000..4f7ddb1 --- /dev/null +++ b/fixtures/faq.json @@ -0,0 +1,112 @@ +[ + { + "model": "junior.faq", + "pk": 1, + "fields": { + "question": "What is ZOD ?", + "description": "We are a future neobank for under 18. We aim to provide children with the ability to use debit cards under the watchfull eye of their parents.", + "status": 1, + "created_at": "2023-11-08T12:32:55.291Z", + "updated_at": "2023-11-08T12:32:55.291Z" + } + }, + { + "model": "junior.faq", + "pk": 2, + "fields": { + "question": "What is financial literacy ?", + "description": "", + "status": 2, + "created_at": "2023-11-08T12:32:55.291Z", + "updated_at": "2023-11-08T12:32:55.291Z" + } + }, + { + "model": "junior.faq", + "pk": 3, + "fields": { + "question": "How can we win with Zod ?", + "description": "", + "status": 2, + "created_at": "2023-11-08T12:32:55.291Z", + "updated_at": "2023-11-08T12:32:55.291Z" + } + }, + { + "model": "junior.faq", + "pk": 4, + "fields": { + "question": "What is a budget ?", + "description": "", + "status": 2, + "created_at": "2023-11-08T12:32:55.291Z", + "updated_at": "2023-11-08T12:32:55.291Z" + } + }, + { + "model": "junior.faq", + "pk": 5, + "fields": { + "question": "What is the difference between stocks and bonds ?", + "description": "", + "status": 2, + "created_at": "2023-11-08T12:32:55.291Z", + "updated_at": "2023-11-08T12:32:55.291Z" + } + }, + { + "model": "junior.faq", + "pk": 6, + "fields": { + "question": "What is compound interest ?", + "description": "", + "status": 2, + "created_at": "2023-11-08T12:32:55.291Z", + "updated_at": "2023-11-08T12:32:55.291Z" + } + }, + { + "model": "junior.faq", + "pk": 7, + "fields": { + "question": "What is diversification ?", + "description": "", + "status": 2, + "created_at": "2023-11-08T12:32:55.291Z", + "updated_at": "2023-11-08T12:32:55.291Z" + } + }, + { + "model": "junior.faq", + "pk": 8, + "fields": { + "question": "What is a 401(k) ?", + "description": "", + "status": 2, + "created_at": "2023-11-08T12:32:55.291Z", + "updated_at": "2023-11-08T12:32:55.291Z" + } + }, + { + "model": "junior.faq", + "pk": 9, + "fields": { + "question": "What is an emergency fund ?", + "description": "", + "status": 2, + "created_at": "2023-11-08T12:32:55.291Z", + "updated_at": "2023-11-08T12:32:55.291Z" + } + }, + { + "model": "junior.faq", + "pk": 10, + "fields": { + "question": "What is a mortgage ?", + "description": "", + "status": 2, + "created_at": "2023-11-08T12:32:55.291Z", + "updated_at": "2023-11-08T12:32:55.291Z" + } + } +] \ No newline at end of file diff --git a/junior/views.py b/junior/views.py index 80cc89b..9b1d67e 100644 --- a/junior/views.py +++ b/junior/views.py @@ -19,6 +19,7 @@ from base.pagination import CustomPageNumberPagination """Django app import""" from drf_yasg.utils import swagger_auto_schema from drf_yasg import openapi +from django.core.management import call_command from drf_yasg.views import get_schema_view # Import guardian's model, # Import junior's model, @@ -813,7 +814,7 @@ class FAQViewSet(GenericViewSet, mixins.CreateModelMixin, http_method_names = ['get', 'post'] def get_queryset(self): - return FAQ.objects.all() + return FAQ.objects.filter(status=1).order_by('id') def create(self, request, *args, **kwargs): """ @@ -823,6 +824,10 @@ class FAQViewSet(GenericViewSet, mixins.CreateModelMixin, :param kwargs: :return: success message """ + load_fixture = request.query_params.get('load_fixture') + if load_fixture: + call_command('loaddata', 'fixtures/faq.json') + return custom_response(SUCCESS_CODE["3045"], response_status=status.HTTP_200_OK) obj_data = [FAQ(**item) for item in request.data] try: FAQ.objects.bulk_create(obj_data) From 5c05a988a5436487e2ab02005c0dea4db69134d4 Mon Sep 17 00:00:00 2001 From: abutalib-kiwi Date: Wed, 8 Nov 2023 18:54:54 +0530 Subject: [PATCH 3/3] new line in faq_json file --- fixtures/faq.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fixtures/faq.json b/fixtures/faq.json index 4f7ddb1..3221c7e 100644 --- a/fixtures/faq.json +++ b/fixtures/faq.json @@ -109,4 +109,4 @@ "updated_at": "2023-11-08T12:32:55.291Z" } } -] \ No newline at end of file +]