Add functionality to clear blacklisted music videos in GroupClearBlacklistView and update group detail template
This commit is contained in:
parent
c55861c439
commit
e64bb8b95a
3 changed files with 15 additions and 0 deletions
|
@ -10,6 +10,7 @@
|
|||
</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>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% if group.musikgame_set %}
|
||||
|
|
|
@ -41,4 +41,9 @@ urlpatterns = [
|
|||
views.YoutubeCallbackView.as_view(),
|
||||
name="youtube_callback",
|
||||
),
|
||||
path(
|
||||
"group/<int:pk>/clear_blacklist/",
|
||||
views.GroupClearBlacklistView.as_view(),
|
||||
name="group_clear_blacklist",
|
||||
),
|
||||
]
|
||||
|
|
|
@ -246,3 +246,12 @@ class YoutubeCallbackView(LoginRequiredMixin, View):
|
|||
},
|
||||
)
|
||||
return redirect("/")
|
||||
|
||||
|
||||
class GroupClearBlacklistView(OwnerFilterMixin, SingleObjectMixin, View):
|
||||
model = models.Group
|
||||
|
||||
def get(self, request, pk):
|
||||
group = self.get_object()
|
||||
group.musicvideo_set.filter(blacklisted=True).update(blacklisted=False)
|
||||
return redirect(group)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue