Update PostType and PostTagType field definitions

Replaced `fields = "__all__"` with specific fields for better control and security. Removed unused `filter_fields` to clean up the code and align with actual requirements. These changes improve maintainability and clarity.
This commit is contained in:
Egor Pavlovich Gorbunov 2025-04-30 00:37:09 +03:00
parent 68febcdb08
commit bbde0a4654

View file

@ -11,9 +11,8 @@ class PostType(DjangoObjectType):
class Meta: class Meta:
model = Post model = Post
fields = "__all__" fields = ["tags", "content", "title", "slug"]
interfaces = (relay.Node,) interfaces = (relay.Node,)
filter_fields = ["is_active"]
def resolve_content(self, info): def resolve_content(self, info):
return self.content.html.replace("\n", "<br/>") return self.content.html.replace("\n", "<br/>")
@ -24,4 +23,3 @@ class PostTagType(DjangoObjectType):
model = PostTag model = PostTag
fields = "__all__" fields = "__all__"
interfaces = (relay.Node,) interfaces = (relay.Node,)
filter_fields = ["is_active"]