Hi,
I'm writing a hockey database/manager. So I have the following models:
class Team(models.Model):
name = models.CharField(max_length=60)
class Game(models.Model):
home_team = models.ForeignKey(Team,related_name='home_team')
away_team = models.ForeignKey(Team,related_name='away_team')
class SeasonStats(models.Model):
team = models.ForeignKey(Team)
Ok, so my problem is the following. There are a lot of teams, but Stats are just managed for my Club. So if I use "list_display" in the admin backend, I'd like to modify/overwrite the queryset which builds the sidebar for filtering, to just display our home teams as a filter option.
Is this somehow possible in Django?
I already made a custom form like this
class SeasonPlayerStatsAdminForm(forms.ModelForm):
team = forms.ModelChoiceField(Team.objects.filter(club__home=True))
So now just the filtering is missing. Any ideas?