mirror of https://github.com/ae-utbm/sith3.git
com: use MarkdownInput for weekmail
This commit is contained in:
parent
d53d725415
commit
d2021ecf7e
20
com/views.py
20
com/views.py
|
@ -49,7 +49,7 @@ from core.views import (
|
|||
CanCreateMixin,
|
||||
QuickNotifMixin,
|
||||
)
|
||||
from core.views.forms import SelectDateTime
|
||||
from core.views.forms import SelectDateTime, MarkdownInput
|
||||
from core.models import Notification, RealGroup, User
|
||||
from club.models import Club, Mailing
|
||||
|
||||
|
@ -461,6 +461,12 @@ class WeekmailEditView(ComTabsMixin, QuickNotifMixin, CanEditPropMixin, UpdateVi
|
|||
Weekmail,
|
||||
fields=["title", "intro", "joke", "protip", "conclusion"],
|
||||
help_texts={"title": _("Delete and save to regenerate")},
|
||||
widgets={
|
||||
"intro": MarkdownInput,
|
||||
"joke": MarkdownInput,
|
||||
"protip": MarkdownInput,
|
||||
"conclusion": MarkdownInput,
|
||||
},
|
||||
)
|
||||
success_url = reverse_lazy("com:weekmail")
|
||||
current_tab = "weekmail"
|
||||
|
@ -533,7 +539,11 @@ class WeekmailArticleEditView(
|
|||
"""Edit an article"""
|
||||
|
||||
model = WeekmailArticle
|
||||
fields = ["title", "club", "content"]
|
||||
form_class = modelform_factory(
|
||||
WeekmailArticle,
|
||||
fields=["title", "club", "content"],
|
||||
widgets={"content": MarkdownInput},
|
||||
)
|
||||
pk_url_kwarg = "article_id"
|
||||
template_name = "core/edit.jinja"
|
||||
success_url = reverse_lazy("com:weekmail")
|
||||
|
@ -545,7 +555,11 @@ class WeekmailArticleCreateView(QuickNotifMixin, CreateView):
|
|||
"""Post an article"""
|
||||
|
||||
model = WeekmailArticle
|
||||
fields = ["title", "club", "content"]
|
||||
form_class = modelform_factory(
|
||||
WeekmailArticle,
|
||||
fields=["title", "club", "content"],
|
||||
widgets={"content": MarkdownInput},
|
||||
)
|
||||
template_name = "core/create.jinja"
|
||||
success_url = reverse_lazy("core:user_tools")
|
||||
quick_notif_url_arg = "qn_weekmail_new_article"
|
||||
|
|
Loading…
Reference in New Issue