I'm creating a game website and i have these models for games:
class Game(models.Model):
accountant = models.ForeignKey(get_user_model(), on_delete=models.CASCADE, related_name='games')
title = models.CharField(max_length=50)
bank_money = models.IntegerField()
player_starting_money = models.IntegerField()
golden_card_amount = models.PositiveIntegerField(
validators=[
MinValueValidator(100),
MaxValueValidator(1000)
]
)
now i want every user to see their own games at dashbard:
class DashboardView(mixins.LoginRequiredMixin, generic.ListView):
template_name = 'games/dashboard.html'
model = models.Game
how can i do this (show every user their own games, not all games)?