Skip to content

Commit

Permalink
reuse rendered_md template in TopicContentView and TopicCertifiedPost…
Browse files Browse the repository at this point in the history
…View
  • Loading branch information
vincentporte committed Nov 8, 2024
1 parent 5294e1e commit 527ba29
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 7 additions & 3 deletions lacommunaute/forum_conversation/views_htmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@


class TopicContentView(PermissionRequiredMixin, View):
template = "forum_conversation/partials/topic_content.html"
template = "partials/rendered_md.html"
permission_required = [
"can_read_forum",
]
Expand All @@ -32,6 +32,9 @@ def get_topic(self):
)
return self.topic

def get_content(self):
return self.get_topic().first_post.content

def get(self, request, **kwargs):
topic = self.get_topic()

Expand All @@ -40,15 +43,16 @@ def get(self, request, **kwargs):
return render(
request,
self.template,
context={"topic": topic},
context={"content": self.get_content()},
)

def get_controlled_object(self):
return self.get_topic().forum


class TopicCertifiedPostView(TopicContentView):
template = "forum_conversation/partials/topic_certified_post.html"
def get_content(self):
return self.get_topic().certified_post.post.content


class PostListView(PermissionRequiredMixin, View):
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 527ba29

Please sign in to comment.