Compare commits

..

No commits in common. "51b44bcec145902d1520d0ab713168f20b862d4d" and "4b331f7968d167462d060205e230d013f4388305" have entirely different histories.

2 changed files with 1 additions and 20 deletions

View file

@ -1,10 +1,6 @@
import google.oauth2.credentials
import googleapiclient.discovery
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.db import models from django.db import models
from django.db.models.functions import Lower from django.db.models.functions import Lower
from django.db.models.signals import post_delete
from django.dispatch import receiver
from django.urls import reverse from django.urls import reverse
@ -57,20 +53,6 @@ class MusikGame(models.Model):
return reverse("game_detail", kwargs={"pk": self.pk}) return reverse("game_detail", kwargs={"pk": self.pk})
@receiver(post_delete, sender=MusikGame)
def deleteYoutubePlaylist(sender, instance, using, **kwargs):
if not instance.playlist:
return
game = instance
credentials = google.oauth2.credentials.Credentials(
**game.group.owner.youtubecredentials.credentials
)
yt_api = googleapiclient.discovery.build("youtube", "v3", credentials=credentials)
pl_request = yt_api.playlists().delete(id=game.playlist)
pl_request.execute()
class MusicGameOrder(models.Model): class MusicGameOrder(models.Model):
game = models.ForeignKey(MusikGame, on_delete=models.CASCADE) game = models.ForeignKey(MusikGame, on_delete=models.CASCADE)
player = models.ForeignKey(User, on_delete=models.CASCADE) player = models.ForeignKey(User, on_delete=models.CASCADE)

View file

@ -57,8 +57,7 @@
</td> </td>
<td> <td>
{% if game.playlist %} {% if game.playlist %}
<a href="{% yt_playlist game %}" <a href="{% yt_playlist game %}"><i class="ri-youtube-fill"></i> Playlist</a>
{% if game.playlist_loading %}aria-busy="true"{% endif %}><i class="ri-youtube-fill"></i> Playlist</a>
{% endif %} {% endif %}
</td> </td>
<td>{{ game.players.all|join:", " }}</td> <td>{{ game.players.all|join:", " }}</td>