communication

This commit is contained in:
rizwanisready
2024-03-09 22:54:33 +05:30
parent 27194df8f8
commit c37592fb44
7 changed files with 45 additions and 40 deletions

View File

@@ -572,19 +572,18 @@ class EventFilterService:
class MyEventFilterService:
@staticmethod
def filter_my_events_draft(user):
today = timezone.now().date()
# today = timezone.now().date()
current_and_future_events_query = Q(
start_date__lte=today, end_date__gte=today
) | Q(start_date__gt=today)
# current_and_future_events_query = Q(
# start_date__lte=today, end_date__gte=today
# ) | Q(start_date__gt=today)
events = Event.objects.filter(
current_and_future_events_query,
draft=True,
deleted=False,
active=True,
created_by=user,
).distinct()
)
return events

View File

@@ -45,7 +45,7 @@ urlpatterns = [
path('api/wallet/', include("manage_wallets.api.urls")),
path("communications/", include("manage_communications.urls")),
# path('api/communications/', include("manage_communications.api.urls")),
path('api/communications/', include("manage_communications.api.urls")),
# path('chat/', include('chat.urls')),
# path('api/chat/', include("chat.api.urls")),

View File

@@ -62,11 +62,10 @@ class FeedbackSerializer(serializers.ModelSerializer):
RATING_CHOICES = Feedback.RATING_CHOICES
rating = serializers.ChoiceField(choices=RATING_CHOICES)
feedback_reaction = serializers.SerializerMethodField()
class Meta:
model = Feedback
fields = ['principal', 'email', 'comment', 'rating', 'feedback_reaction']
fields = ['principal', 'email', 'comment', 'rating']
def get_feedback_reaction(self, obj):
rating = obj.rating

View File

@@ -32,6 +32,7 @@ class ContactUsView(APIView):
return ApiResponse.success(data=serializer.data, message=constants.SUCCESS)
class TicketView(APIView):
serializer_class = serializers.TicketsSerializer
model = Tickets

View File

@@ -0,0 +1,25 @@
# Generated by Django 5.0.2 on 2024-03-09 17:23
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("manage_communications", "0001_initial"),
]
operations = [
migrations.RemoveField(
model_name="feedback",
name="feedback_reaction",
),
migrations.AlterField(
model_name="feedback",
name="rating",
field=models.PositiveSmallIntegerField(
choices=[(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)],
help_text="Rating provided by the user",
),
),
]

View File

@@ -73,26 +73,14 @@ class Tickets(BaseModel):
self.ticket_status = self.RESOLVED
self.save()
class Feedback(BaseModel):
VERY_BAD = "Very Bad"
POOR = "Poor"
MEDIUM = "Medium"
GOOD = "Good"
EXCELLENT = "Excellent"
class Feedback(BaseModel):
RATING_CHOICES = (
(1, "1 Star"),
(2, "2 Stars"),
(3, "3 Stars"),
(4, "4 Stars"),
(5, "5 Stars"),
)
FEEDBACK_REACTION = (
(VERY_BAD, "Very Bad"),
(POOR, "Poor"),
(MEDIUM, "Medium"),
(GOOD, "Good"),
(EXCELLENT, "Excellent"),
(1, 1),
(2, 2),
(3, 3),
(4, 4),
(5, 5),
)
principal = models.ForeignKey(
@@ -106,13 +94,6 @@ class Feedback(BaseModel):
email = models.EmailField(null=True, blank=True, help_text="Email address of the feedback provider")
comment = models.TextField(help_text="Feedback comment")
rating = models.PositiveSmallIntegerField(choices=RATING_CHOICES, help_text="Rating provided by the user")
feedback_reaction = models.CharField(
max_length=20,
choices=FEEDBACK_REACTION,
null=True,
blank=True,
help_text="Reaction associated with the feedback",
)
class Meta:
db_table = "feedback"
@@ -121,7 +102,5 @@ class Feedback(BaseModel):
return f"Author: {self.principal}, Comment: {self.comment}, Rating: {self.rating}"
def get_rating_display(self):
for value, label in self.RATING_CHOICES:
if value == self.rating:
return label
return ""
rating_labels = {value: label for value, label in self.RATING_CHOICES}
return rating_labels.get(self.rating, "")

View File

@@ -269,7 +269,9 @@ class VenueListView(generics.ListAPIView):
def get_queryset(self):
# Ensures that a user sees only their venues
return Venue.objects.filter(created_by=self.request.user)
return Venue.objects.filter(
created_by=self.request.user, deleted=False, active=True
)
def list(self, request, *args, **kwargs):
queryset = self.get_queryset()
@@ -289,7 +291,7 @@ class VenueDetailView(generics.RetrieveUpdateDestroyAPIView):
def get_queryset(self):
# This ensures a user can only access their own venues
return self.queryset.filter(created_by=self.request.user)
return self.queryset.filter(created_by=self.request.user, deleted=False, active=True)
class GeocodeAPIView(APIView):