From 7b69e53b9ffec5758fbf504bbe322bc47d18fee6 Mon Sep 17 00:00:00 2001 From: Bishwas Praveen Date: Thu, 19 Sep 2024 15:10:27 -0500 Subject: [PATCH 1/3] add another field for the feedback form --- feedback/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/feedback/models.py b/feedback/models.py index de2921b5..feb8d661 100644 --- a/feedback/models.py +++ b/feedback/models.py @@ -8,6 +8,7 @@ class Feedback(models.Model): name = models.CharField(max_length=150) email = models.EmailField() subject = models.CharField(max_length=400) + category = models.TextField(default="", blank=True) comments = models.TextField() source = models.CharField(max_length=50, default="SDE", blank=True) created_at = models.DateTimeField(null=True, blank=True) @@ -37,6 +38,7 @@ def format_notification_message(self): f"Name: {self.name}\n" f"Email: {self.email}\n" f"Subject: {self.subject}\n" + f"Feedback Category: {self.category}\n" f"Comments: {self.comments}\n" f"Source: {self.source}\n" f"Received on: {self.created_at.strftime('%Y-%m-%d %H:%M:%S')}" From eba8b093598b959724a515237aa7d8f53e590145 Mon Sep 17 00:00:00 2001 From: Bishwas Praveen Date: Thu, 19 Sep 2024 15:10:48 -0500 Subject: [PATCH 2/3] pass the added field to the serialzer --- feedback/serializers.py | 1 + 1 file changed, 1 insertion(+) diff --git a/feedback/serializers.py b/feedback/serializers.py index 6956e16f..8769e37d 100644 --- a/feedback/serializers.py +++ b/feedback/serializers.py @@ -10,6 +10,7 @@ class Meta: "name", "email", "subject", + "category", "comments", "source", "created_at", From 52aa09a8270e5ddd77337ccaac7df789435ba84f Mon Sep 17 00:00:00 2001 From: Bishwas Praveen Date: Thu, 19 Sep 2024 15:11:12 -0500 Subject: [PATCH 3/3] adding the migration file --- feedback/migrations/0005_feedback_category.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 feedback/migrations/0005_feedback_category.py diff --git a/feedback/migrations/0005_feedback_category.py b/feedback/migrations/0005_feedback_category.py new file mode 100644 index 00000000..9864f758 --- /dev/null +++ b/feedback/migrations/0005_feedback_category.py @@ -0,0 +1,18 @@ +# Generated by Django 4.2.9 on 2024-09-19 19:50 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("feedback", "0004_contentcurationrequest_created_at_and_more"), + ] + + operations = [ + migrations.AddField( + model_name="feedback", + name="category", + field=models.TextField(blank=True, default=""), + ), + ]