From a644cb15db1846c81661d76c0986b3c1096b77e2 Mon Sep 17 00:00:00 2001 From: Jason Date: Sun, 1 Oct 2023 21:54:05 -0400 Subject: [PATCH] API (flatpages): allowed listing + allowed filtering by ID in addition to URL --- core/api/views/objects/flatpage.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/api/views/objects/flatpage.py b/core/api/views/objects/flatpage.py index 7578ef45..cb1e2ae6 100644 --- a/core/api/views/objects/flatpage.py +++ b/core/api/views/objects/flatpage.py @@ -9,14 +9,18 @@ class Serializer(serializers.ModelSerializer): class Meta: model = FlatPage - fields = "__all__" + exclude = [ + "sites", + "enable_comments", + "template_name", + ] # fields = all - sites, enable_comments, template_name class FlatPageProvider(BaseProvider): serializer_class = Serializer model = FlatPage - allow_list = False - lookup_fields = ["url"] + allow_list = True + lookup_fields = ["id", "url"] @property def permission_classes(self):