From b46109e487c8fe35fb6c18fe0e65e08ed75f6521 Mon Sep 17 00:00:00 2001 From: jain Date: Thu, 17 Aug 2023 16:06:58 +0530 Subject: [PATCH] FAQ list and creation --- junior/migrations/0028_faq_status.py | 18 ++++++++++++++++++ junior/models.py | 6 ++++-- junior/serializers.py | 5 ----- 3 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 junior/migrations/0028_faq_status.py diff --git a/junior/migrations/0028_faq_status.py b/junior/migrations/0028_faq_status.py new file mode 100644 index 0000000..bdfbf67 --- /dev/null +++ b/junior/migrations/0028_faq_status.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.2 on 2023-08-17 10:28 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('junior', '0027_alter_faq_question'), + ] + + operations = [ + migrations.AddField( + model_name='faq', + name='status', + field=models.IntegerField(blank=True, default=1, null=True), + ), + ] diff --git a/junior/models.py b/junior/models.py index d3d2bcf..c256800 100644 --- a/junior/models.py +++ b/junior/models.py @@ -222,10 +222,12 @@ class JuniorArticleCard(models.Model): class FAQ(models.Model): """FAQ model""" - # Total earned points""" + # questions""" question = models.CharField(max_length=100) - # referral points""" + # answer""" description = models.CharField(max_length=500) + # status + status = models.IntegerField(default=1, null=True, blank=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) diff --git a/junior/serializers.py b/junior/serializers.py index c03698e..1150bd8 100644 --- a/junior/serializers.py +++ b/junior/serializers.py @@ -517,8 +517,3 @@ class FAQSerializer(serializers.ModelSerializer): model = FAQ fields = ('id', 'question', 'description') - def create(self, validated_data): - # validate data - print("validated_data===>",validated_data) - faq = FAQ.objects.bulk_create(**validated_data) - return faq