Compare commits
No commits in common. "51b44bcec145902d1520d0ab713168f20b862d4d" and "4b331f7968d167462d060205e230d013f4388305" have entirely different histories.
51b44bcec1
...
4b331f7968
2 changed files with 1 additions and 20 deletions
|
@ -1,10 +1,6 @@
|
|||
import google.oauth2.credentials
|
||||
import googleapiclient.discovery
|
||||
from django.contrib.auth.models import User
|
||||
from django.db import models
|
||||
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
|
||||
|
||||
|
||||
|
@ -57,20 +53,6 @@ class MusikGame(models.Model):
|
|||
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):
|
||||
game = models.ForeignKey(MusikGame, on_delete=models.CASCADE)
|
||||
player = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
|
|
|
@ -57,8 +57,7 @@
|
|||
</td>
|
||||
<td>
|
||||
{% if game.playlist %}
|
||||
<a href="{% yt_playlist game %}"
|
||||
{% if game.playlist_loading %}aria-busy="true"{% endif %}><i class="ri-youtube-fill"></i> Playlist</a>
|
||||
<a href="{% yt_playlist game %}"><i class="ri-youtube-fill"></i> Playlist</a>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ game.players.all|join:", " }}</td>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue