Skip to content

Commit

Permalink
Change code of commit 5fa5fff to use template abilities instead of co…
Browse files Browse the repository at this point in the history
…ntext variables
  • Loading branch information
Ludovic Druette committed Apr 19, 2022
1 parent 0090980 commit 7108be7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 2 additions & 2 deletions back/news/templates/news/post_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ <h3 class="page-title">{% if Edit %}Éditer{% else %}Créer{% endif %} un post</
{% csrf_token %}
<div class="news-card-content">
<div class="centered-div">
{% if IsInClub %}
{{EditPost.club.errors}}
{{EditPost.club.errors}}
{% if EditPost.club|length > 1 %}
<div class="input-title">Publier en tant que :</div>
{{EditPost.club}}
{% endif %}
Expand Down
2 changes: 0 additions & 2 deletions back/news/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ 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")
Expand Down Expand Up @@ -197,7 +196,6 @@ 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)

Expand Down

0 comments on commit 7108be7

Please sign in to comment.