diff --git a/controlpanel/api/admin.py b/controlpanel/api/admin.py index ad9e199f..016cfc36 100644 --- a/controlpanel/api/admin.py +++ b/controlpanel/api/admin.py @@ -3,7 +3,7 @@ from simple_history.admin import SimpleHistoryAdmin # First-party/Local -from controlpanel.api.models import App, IPAllowlist, S3Bucket, User +from controlpanel.api.models import App, Feedback, IPAllowlist, S3Bucket, User def make_migration_pending(modeladmin, request, queryset): @@ -58,7 +58,12 @@ class IPAllowlistAdmin(SimpleHistoryAdmin): history_list_display = ("description", "contact", "allowed_ip_ranges") +class FeedbackAdmin(admin.ModelAdmin): + list_display = ("satisfaction_rating", "suggestions", "date_added") + + admin.site.register(App, AppAdmin) admin.site.register(S3Bucket, S3Admin) admin.site.register(User, UserAdmin) admin.site.register(IPAllowlist, IPAllowlistAdmin) +admin.site.register(Feedback, FeedbackAdmin) diff --git a/controlpanel/api/models/feedback.py b/controlpanel/api/models/feedback.py index 3ce7a835..6739b80f 100644 --- a/controlpanel/api/models/feedback.py +++ b/controlpanel/api/models/feedback.py @@ -18,7 +18,7 @@ class Feedback(models.Model): blank=False, ) - suggestions = models.TextField() + suggestions = models.TextField(blank=True) date_added = models.DateTimeField(default=timezone.now) class Meta: diff --git a/controlpanel/frontend/views/feedback.py b/controlpanel/frontend/views/feedback.py index 7c1d16bd..d4a7d3be 100644 --- a/controlpanel/frontend/views/feedback.py +++ b/controlpanel/frontend/views/feedback.py @@ -17,10 +17,6 @@ class CreateFeedback(OIDCLoginRequiredMixin, CreateView): def get_success_url(self): return reverse_lazy("feedback-thanks") - def form_valid(self, form): - form.save() - return FormMixin.form_valid(self, form) - class FeedbackThanks(OIDCLoginRequiredMixin, TemplateView): template_name = "feedback-thanks.html"