com: use MarkdownInput for weekmail

This commit is contained in:
Antoine Bartuccio 2018-12-20 15:06:20 +01:00
parent d53d725415
commit d2021ecf7e

View File

@ -49,7 +49,7 @@ from core.views import (
CanCreateMixin, CanCreateMixin,
QuickNotifMixin, QuickNotifMixin,
) )
from core.views.forms import SelectDateTime from core.views.forms import SelectDateTime, MarkdownInput
from core.models import Notification, RealGroup, User from core.models import Notification, RealGroup, User
from club.models import Club, Mailing from club.models import Club, Mailing
@ -461,6 +461,12 @@ class WeekmailEditView(ComTabsMixin, QuickNotifMixin, CanEditPropMixin, UpdateVi
Weekmail, Weekmail,
fields=["title", "intro", "joke", "protip", "conclusion"], fields=["title", "intro", "joke", "protip", "conclusion"],
help_texts={"title": _("Delete and save to regenerate")}, help_texts={"title": _("Delete and save to regenerate")},
widgets={
"intro": MarkdownInput,
"joke": MarkdownInput,
"protip": MarkdownInput,
"conclusion": MarkdownInput,
},
) )
success_url = reverse_lazy("com:weekmail") success_url = reverse_lazy("com:weekmail")
current_tab = "weekmail" current_tab = "weekmail"
@ -533,7 +539,11 @@ class WeekmailArticleEditView(
"""Edit an article""" """Edit an article"""
model = WeekmailArticle model = WeekmailArticle
fields = ["title", "club", "content"] form_class = modelform_factory(
WeekmailArticle,
fields=["title", "club", "content"],
widgets={"content": MarkdownInput},
)
pk_url_kwarg = "article_id" pk_url_kwarg = "article_id"
template_name = "core/edit.jinja" template_name = "core/edit.jinja"
success_url = reverse_lazy("com:weekmail") success_url = reverse_lazy("com:weekmail")
@ -545,7 +555,11 @@ class WeekmailArticleCreateView(QuickNotifMixin, CreateView):
"""Post an article""" """Post an article"""
model = WeekmailArticle model = WeekmailArticle
fields = ["title", "club", "content"] form_class = modelform_factory(
WeekmailArticle,
fields=["title", "club", "content"],
widgets={"content": MarkdownInput},
)
template_name = "core/create.jinja" template_name = "core/create.jinja"
success_url = reverse_lazy("core:user_tools") success_url = reverse_lazy("core:user_tools")
quick_notif_url_arg = "qn_weekmail_new_article" quick_notif_url_arg = "qn_weekmail_new_article"