- {{EditPost.club.errors}}
-
Publier en tant que :
- {{EditPost.club}}
+ {% if IsInClub %}
+ {{EditPost.club.errors}}
+
Publier en tant que :
+ {{EditPost.club}}
+ {% endif %}
{{EditPost.event.errors}}
Est-ce que ce post est associé à un évènement ?
diff --git a/back/news/views.py b/back/news/views.py
index 700455e0..b4ee795b 100644
--- a/back/news/views.py
+++ b/back/news/views.py
@@ -168,6 +168,7 @@ def post_edit(request, post_id):
else:
form = EditPost(request.user.id, instance=post)
context["EditPost"] = form
+ context["IsInClub"] = len(form.fields["club"].choices) > 1
context["post"] = post
context["Edit"] = True
request.session["origin"] = request.META.get("HTTP_REFERER", "news:posts")
@@ -196,6 +197,7 @@ def post_create(request, event_id=None):
form.fields["event"].initial = get_object_or_404(Event, id=event_id)
request.session["origin"] = request.META.get("HTTP_REFERER", "news:posts")
context["EditPost"] = form
+ context["IsInClub"] = len(form.fields["club"].choices) > 1
context["Edit"] = False
return render(request, "news/post_edit.html", context)