Skip to content

Commit

Permalink
"Removed UserFeedback model from admin_panel/models.py and updated im…
Browse files Browse the repository at this point in the history
…port in admin_panel/views.py to use Feedback model from client.models instead."
  • Loading branch information
NexusGKSoftwares committed Dec 1, 2024
1 parent ccea5f2 commit cb79cdd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 9 deletions.
Binary file modified admin_panel/__pycache__/admin.cpython-310.pyc
Binary file not shown.
Binary file modified admin_panel/__pycache__/models.cpython-310.pyc
Binary file not shown.
Binary file modified admin_panel/__pycache__/views.cpython-310.pyc
Binary file not shown.
14 changes: 7 additions & 7 deletions admin_panel/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@ def __str__(self):
return f"Ticket #{self.id}: {self.subject}"

# Model for User Feedback
class UserFeedback(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, related_name="feedback")
rating = models.IntegerField(choices=[(1, '1 - Poor'), (2, '2 - Fair'), (3, '3 - Good'), (4, '4 - Very Good'), (5, '5 - Excellent')])
comments = models.TextField()
date_submitted = models.DateTimeField(auto_now_add=True)
# class UserFeedback(models.Model):
# user = models.ForeignKey(User, on_delete=models.CASCADE, related_name="feedback")
# rating = models.IntegerField(choices=[(1, '1 - Poor'), (2, '2 - Fair'), (3, '3 - Good'), (4, '4 - Very Good'), (5, '5 - Excellent')])
# comments = models.TextField()
# date_submitted = models.DateTimeField(auto_now_add=True)

def __str__(self):
return f"Feedback by {self.user.username} on {self.date_submitted}"
# def __str__(self):
# return f"Feedback by {self.user.username} on {self.date_submitted}"
class SystemHealth(models.Model):
cpu_usage = models.DecimalField(max_digits=5, decimal_places=2, help_text="CPU usage percentage (0-100%)")
memory_usage = models.DecimalField(max_digits=5, decimal_places=2, help_text="Memory usage percentage (0-100%)")
Expand Down
6 changes: 4 additions & 2 deletions admin_panel/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
from django.shortcuts import render

from .models import Activity, User, JobPosting, Payment, SystemHealth, SupportTicket, UserFeedback
from client.models import Feedback

from .models import Activity, User, JobPosting, Payment, SystemHealth, SupportTicket

# Admin dashboard view
def admin_dashboard(request):
Expand Down Expand Up @@ -70,7 +72,7 @@ def admin_support_tickets(request):

# View for managing user feedback
def admin_user_feedback(request):
feedback = UserFeedback.objects.all()
feedback = Feedback.objects.all()
return render(request, 'admin_user_feedback.html', {'feedback': feedback})

# View for managing freelancers
Expand Down

0 comments on commit cb79cdd

Please sign in to comment.