Is it possible to filter the built-in autocomplete field with a dynamic value entered by the user?
For example, I have a form for the administrator in which employees enter information about the games, including the home and away team, the date and time of the game, the score, etc. They also enter the names and statistics of individual players. I would like to add a filter to show only players in the home or guest team.
I use the InlineAutocompleteAdmin module , which provides autocomplete hints for input fields.
Here is the current autocomplete code in the line:
class IndividualFootballGameInline(InlineAutocompleteAdmin):
model = IndividualFootballGame
extra = 1
related_search_fields = {
'player': ('player__first_name', 'player__last_name', '#team__sport__sport=Football', '#team__season__season_start_date__year=' + str(get_current_season_start_year('football'))),
}
If this can be done, can you explain how?
source
share