Refactor group detail view: update blacklist clearing to use POST method and enhance button layout for group actions
This commit is contained in:
parent
637b497362
commit
5de1c8f520
2 changed files with 15 additions and 6 deletions
|
@ -11,11 +11,20 @@
|
|||
</h1>
|
||||
{% if group.owner == user %}
|
||||
<p>
|
||||
<a href="{% url "group_update" pk=group.pk %}"><i class="ri-edit-line"></i> Modifier le groupe</a>
|
||||
</p>
|
||||
<p>
|
||||
<a href="{% url "start_game" pk=group.pk %}" role="button"><i class="ri-play-fill"></i> Lancer une partie</a>
|
||||
<a href="{% url "group_clear_blacklist" pk=group.pk %}" role="button"><i class="ri-history-fill"></i> Effacer la blacklist</a>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<div role="group">
|
||||
<a href="{% url "start_game" pk=group.pk %}" role="button"><i class="ri-play-fill"></i> Jouer</a>
|
||||
<a href="{% url "group_update" pk=group.pk %}"
|
||||
class="secondary"
|
||||
role="button"><i class="ri-edit-line"></i> Renommer</a>
|
||||
<button type="submit"
|
||||
class="contrast"
|
||||
formaction="{% url "group_clear_blacklist" pk=group.pk %}">
|
||||
<i class="ri-history-fill"></i> Effacer la blacklist
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if group.musikgame_set.exists %}
|
||||
|
|
|
@ -338,7 +338,7 @@ class YoutubeCallbackView(LoginRequiredMixin, View):
|
|||
class GroupClearBlacklistView(OwnerFilterMixin, SingleObjectMixin, View):
|
||||
model = models.Group
|
||||
|
||||
def get(self, request, pk):
|
||||
def post(self, request, pk):
|
||||
group = self.get_object()
|
||||
group.musicvideo_set.filter(blacklisted=True).update(blacklisted=False)
|
||||
messages.add_message(request, messages.SUCCESS, "La blacklist a été effacée.")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue