New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Permet d'écrire des billets ou articles avec une structure de tutoriel #6550
base: dev
Are you sure you want to change the base?
Permet d'écrire des billets ou articles avec une structure de tutoriel #6550
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Le découpage que tu fais dans les fichiers zds/tutorialv2/urls/urls_opinions.py et zds/tutorialv2/urls/urls_articles.py est bien, mais par souci de cohérence, ce serait bien de le faire aussi dans zds/tutorialv2/urls/urls_tutorials.py.
zds/tutorialv2/models/versioned.py
Outdated
@@ -1,6 +1,7 @@ | |||
import contextlib | |||
import copy | |||
from pathlib import Path | |||
from typing import List |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'étais sceptique qu'on en ait besoin, et j'avais raison, tu ne t'en sers même pas :)
Apparemment, il n'y a plus de cet import depuis Python 3.9.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fait.
8c1cd49
to
86b0dbf
Compare
J'ai fait les modifs. |
86b0dbf
to
0c65fce
Compare
0c65fce
to
98a722c
Compare
f7e8396
to
b11678f
Compare
b11678f
to
8152adf
Compare
8152adf
to
7e1d037
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je n'ai pas testé, mais encore quelques petites remarques sur le code. Il faudrait aussi mettre à jour la documentation, par exemple ici.
zds/tutorialv2/models/versioned.py
Outdated
@@ -265,8 +265,7 @@ def can_add_container(self): | |||
""" | |||
if not self.has_extracts(): | |||
if self.get_tree_depth() < settings.ZDS_APP["content"]["max_tree_depth"] - 1: | |||
if not self.top_container().type in SINGLE_CONTAINER_CONTENT_TYPES: | |||
return True | |||
return True | |||
return False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tout le contenu de cette fonction peut être remplacé par :
return not self.has_extracts() and self.get_tree_depth() < settings.ZDS_APP["content"]["max_tree_depth"] - 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fait.
zds/tutorialv2/models/versioned.py
Outdated
continuous_list.append(child) # it contains Extract, this is a chapter, so paginated | ||
else: # Container is a part | ||
for sub_child in child.children: | ||
continuous_list.append(sub_child) # even if empty `sub_child.childreen`, it's chapter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continuous_list.append(sub_child) # even if empty `sub_child.childreen`, it's chapter | |
continuous_list.append(sub_child) # even if empty `sub_child.children`, it's chapter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fait.
self.assert_can_be_reached(route, route_args) | ||
|
||
|
||
@override_for_contents() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@override_for_contents() |
Tu en as vraiment besoin ? Tu ne l'utilises pas pour OpinionDisplayRoutesTests
et tu le définis pour la classe parente BasicRouteTests
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
La ligne ne sert à rien, effectivement.
Par contre, le décorateur sert dès qu'on joue avec les contenus dans les tests. Sinon, ça pourrit l'environnement de développement et on se retrouve à devoir le reconstruire.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Même si je suppose que c'est testé ailleurs, aussi ajouter les tests équivalents pour les tutoriels ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C'est testé dans les tests fort complexes auxquels on n'aime pas trop toucher. ^^
Je vais ajouter aussi l'équivalent pour les tutoriels, ça évitera de se poser trop de questions et ça facilitera le test des vues de redirections permanentes quand on changera les URL lors de la refonte des types de publication.
7e1d037
to
d8a2cc0
Compare
467f3e6
to
aa38e15
Compare
6e3d1f5
to
a863fb6
Compare
a863fb6
to
f0faa76
Compare
Je continue à découper #6441.
Cette PR permet de créer des billets et articles avec des conteneurs imbriqués, comme pour les tutos. J'ajoute aussi les routes associées, histoire qu'on puisse effectivement lire tout ça. :D
Contrôle qualité
/contenus/
).