Here I'd like to pass a **kwargs dictionary when instantiating my PlayerForm objects and be able to access it when calling __init__() method. This is what I've done below but it's not working.
This is somewhere in my views.py file:
context = {'player_form': PlayerForm(kwargs={'user': request.user})}
This is in my forms.py file
from .models import Game, Player
class PlayerForm(forms.ModelForm):
class Meta:
    model = Player
    fields = ['game', 'username']
def __init__(self, *args, **kwargs):
    super().__init__(*args, **kwargs)
    if kwargs.get('user'):
        self.fields['game'].queryset = Game.objects.exclude(player__user=user)
 
    