Add group detail link and implement game removal functionality in views
This commit is contained in:
parent
122ae40570
commit
dfe312d47d
4 changed files with 47 additions and 7 deletions
|
@ -96,6 +96,19 @@ class GroupRemoveMusicView(OwnerFilterMixin, SingleObjectMixin, View):
|
|||
return redirect(group)
|
||||
|
||||
|
||||
class GroupRemoveGameView(SingleObjectMixin, View):
|
||||
model = models.MusikGame
|
||||
|
||||
def get_queryset(self):
|
||||
return super().get_queryset().filter(group__owner=self.request.user)
|
||||
|
||||
def get(self, request, pk):
|
||||
game = self.get_object()
|
||||
group = game.group
|
||||
game.delete()
|
||||
return redirect(group)
|
||||
|
||||
|
||||
class GameCreateView(LoginRequiredMixin, CreateView):
|
||||
model = models.MusikGame
|
||||
form_class = forms.MusikGameForm
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue