'Django form set css class on selection values
in my django app, i have simple form like this:
class ThrowForm(forms.ModelForm):
def __init__(self,game,*args,**kwargs):
super (ThrowForm,self ).__init__(*args,**kwargs)
self.fields['player_id'].queryset = Player.objects.filter(Q(team_id = game.team1_id) | Q(team_id = game.team2_id))
class Meta:
model = Throw
fields = ['player_id', 'score','game_id']
How can i set an css class on the different values in the player_id field. I imagine that the players of team 1 have a different font color than those of team 2. Is this possible?
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
