Reputation: 375
I got a quick question.
I currently have 2 models, tournaments and matches. Tournament has a One to Many relationship with Match.
Tournament has a field season.
Right, I am filtering Match by Tournament but as you guys might of guessed, there can be more than 1 season.
I would like to know how I can make it so that the user can filter by season and depending on the season he picks, the Tournament filter changes to get all tournaments in that season...
EDIT:
I see that there is some confusion, so let me explain a bit more. I meant the list filters.
The one that you add like this: list_filter = ['tournament_season', 'tournament', 'category', 'tournament_gender']
So basically what I want is, when someone chooses a tournament_season, I want tournament to be filtered and show only the tournament from the chosen tournament_season...
Thanks, Ara
Upvotes: 0
Views: 73
Reputation: 28362
I'm unclear as to what this has to do with django-admin. If this doesn't do what you need please modify your question.
With regard to just generic django, this would be a matter of writing some code that does the filter you have just described. For instance you can get a list of all tournaments in a given season by doing:
tournaments = Tournament.objects.filter(season=season)
# Use tournaments as you usually would Tournament.objects
Upvotes: 0