diff --git a/lacommunaute/forum_conversation/tests/tests_forms.py b/lacommunaute/forum_conversation/tests/tests_forms.py index 9e8e1878c..f31194636 100644 --- a/lacommunaute/forum_conversation/tests/tests_forms.py +++ b/lacommunaute/forum_conversation/tests/tests_forms.py @@ -56,10 +56,7 @@ def fixture_public_forum(): def get_create_topic_url(forum): - return ( - reverse("forum_conversation:topic_create", kwargs={"forum_pk": forum.pk, "forum_slug": forum.slug}) - + "?checked" - ) + return reverse("forum_conversation:topic_create", kwargs={"forum_pk": forum.pk, "forum_slug": forum.slug}) def get_update_topic_url(topic): diff --git a/lacommunaute/forum_conversation/tests/tests_views.py b/lacommunaute/forum_conversation/tests/tests_views.py index ce0d7f120..97fcf8853 100644 --- a/lacommunaute/forum_conversation/tests/tests_views.py +++ b/lacommunaute/forum_conversation/tests/tests_views.py @@ -44,15 +44,12 @@ class TopicCreateViewTest(TestCase): def setUpTestData(cls): cls.poster = UserFactory() cls.forum = ForumFactory(with_public_perms=True) - cls.url = ( - reverse( - "forum_conversation:topic_create", - kwargs={ - "forum_slug": cls.forum.slug, - "forum_pk": cls.forum.pk, - }, - ) - + "?checked=1" + cls.url = reverse( + "forum_conversation:topic_create", + kwargs={ + "forum_slug": cls.forum.slug, + "forum_pk": cls.forum.pk, + }, ) cls.post_data = {"subject": faker.text(max_nb_chars=10), "content": faker.paragraph(nb_sentences=5)} @@ -230,30 +227,6 @@ def test_checked_tags_are_saved(self, *args): class TestTopicCreateView: - def test_redirections_on_forum(self, db, client, snapshot): - forum = ForumFactory(with_public_perms=True) - url = reverse("forum_conversation:topic_create", kwargs={"forum_pk": forum.pk, "forum_slug": forum.slug}) - - response = client.get(url) - assert response.status_code == 302 - assert response.url == reverse( - "forum_conversation_extension:topic_create_check", kwargs={"forum_pk": forum.pk, "forum_slug": forum.slug} - ) - - response = client.get(url + "?checked=1") - assert response.status_code == 200 - content = parse_response_to_soup(response, selector="#div_id_content") - assert str(content) == snapshot(name="topic_create") - - def test_redirections_on_documentation_forum(self, db, client, snapshot): - forum = CategoryForumFactory(with_child=True, with_public_perms=True).get_children().first() - response = client.get( - reverse("forum_conversation:topic_create", kwargs={"forum_pk": forum.pk, "forum_slug": forum.slug}) - ) - assert response.status_code == 200 - content = parse_response_to_soup(response, selector="#div_id_content") - assert str(content) == snapshot(name="topic_create") - def test_create_with_new_tags(self, db, client): forum = ForumFactory(with_public_perms=True) client.force_login(UserFactory()) @@ -1049,38 +1022,3 @@ def test_topic_in_its_own_public_forum(self, client, db, snapshot): response, replace_in_href=[(topic.poster.username, "poster_username")], selector=".poster-infos" ) assert str(soup) == snapshot(name="topic_in_its_own_public_forum") - - -class TestTopicCreateCheckView: - def test_get_method(self, client, db, snapshot): - forum = ForumFactory(name="forum") - response = client.get( - reverse( - "forum_conversation_extension:topic_create_check", - kwargs={"forum_slug": forum.slug, "forum_pk": forum.pk}, - ) - ) - assert response.status_code == 200 - assertContains( - response, - reverse("forum_conversation:topic_create", kwargs={"forum_slug": forum.slug, "forum_pk": forum.pk}) - + "?checked", - ) - content = parse_response_to_soup(response, selector="main", replace_in_href=[forum]) - assert str(content) == snapshot(name="topic_create_check") - - def test_forum_does_not_exist(self, client, db): - response = client.get( - reverse("forum_conversation_extension:topic_create_check", kwargs={"forum_slug": "fake", "forum_pk": 999}) - ) - assert response.status_code == 404 - - def test_post_method_not_allowed(self, client, db): - forum = ForumFactory() - response = client.post( - reverse( - "forum_conversation_extension:topic_create_check", - kwargs={"forum_slug": forum.slug, "forum_pk": forum.pk}, - ) - ) - assert response.status_code == 405 diff --git a/lacommunaute/forum_conversation/urls.py b/lacommunaute/forum_conversation/urls.py index 15d6db873..6a393cb1e 100644 --- a/lacommunaute/forum_conversation/urls.py +++ b/lacommunaute/forum_conversation/urls.py @@ -1,6 +1,6 @@ from django.urls import include, path -from lacommunaute.forum_conversation.views import TopicCreateCheckView, TopicListView +from lacommunaute.forum_conversation.views import TopicListView from lacommunaute.forum_conversation.views_htmx import ( CertifiedPostView, PostFeedCreateView, @@ -18,7 +18,6 @@ path("topic/-/showmore/certified", TopicCertifiedPostView.as_view(), name="showmore_certified"), path("topic/-/comment", PostFeedCreateView.as_view(), name="post_create"), path("topic/-/certify", CertifiedPostView.as_view(), name="certify"), - path("topic/create/check", TopicCreateCheckView.as_view(), name="topic_create_check"), ] diff --git a/lacommunaute/forum_conversation/views.py b/lacommunaute/forum_conversation/views.py index 630fcd9aa..def06aa9b 100644 --- a/lacommunaute/forum_conversation/views.py +++ b/lacommunaute/forum_conversation/views.py @@ -2,9 +2,7 @@ from django.conf import settings from django.contrib import messages -from django.shortcuts import get_object_or_404, redirect, render from django.urls import reverse -from django.views import View from django.views.generic import ListView from machina.apps.forum_conversation import views from machina.core.loading import get_class @@ -31,26 +29,9 @@ def form_valid(self, *args, **kwargs): return valid -class TopicCreateCheckView(View): - def get(self, request, *args, **kwargs): - forum = get_object_or_404(Forum, pk=kwargs["forum_pk"]) - return render(request, "forum_conversation/topic_create_check.html", {"forum": forum}) - - class TopicCreateView(FormValidMixin, views.TopicCreateView): post_form_class = TopicForm - def get(self, request, *args, **kwargs): - forum = self.get_forum() - if forum.is_in_documentation_area or "checked" in self.request.GET: - return super().get(request, *args, **kwargs) - return redirect( - reverse( - "forum_conversation_extension:topic_create_check", - kwargs={"forum_pk": forum.pk, "forum_slug": forum.slug}, - ) - ) - def get_success_url(self): if not self.forum_post.approved: return reverse( diff --git a/lacommunaute/templates/forum_conversation/topic_create_check.html b/lacommunaute/templates/forum_conversation/topic_create_check.html deleted file mode 100644 index 7d1e92ac3..000000000 --- a/lacommunaute/templates/forum_conversation/topic_create_check.html +++ /dev/null @@ -1,73 +0,0 @@ -{% extends "board_base.html" %} -{% load i18n %} -{% load forum_conversation_tags %} -{% block sub_title %} - {% trans "Post a new topic" %} -{% endblock sub_title %} -{% block content %} -
-
-

{{ forum.name }}

-
-
-
-
-

Quelle est ma situation ?

-
-
-
-
-

J'utilise le site des emplois de l'inclusion

-
-
-

- J'ai des questions sur les PASS IAE, leur suspension ou prolongation, le fonctionnement du site des emplois de l'inclusion ou les relations avec l'ASP -

-
- -
-
-
-
-
-

J'accueille des personnes en PMSMP

-
-
-

- J'ai une question Période de Mise en Situation en Milieu Professionnel, le conventionnement, la déclaration des heures ou le fonctionnement du site Immersion Facilitée -

-
- -
-
-
-
-
-

Je suis un/une professionnel/le de l'insertion, en formation ou en activité

-
-
-

- J'ai une question sur l'accompagnement d'une personne éloignée de l'emploi, sur mon parcours de formation ou sur une des fiches pratiques de la communauté -

-
- -
-
-
-{% endblock content %}