I currently have a field that is automatically filled in by taking the value of two additional fields in order: team 1 and team two.
I get the following result with this code within the Administrator class corresponding to the Match model:
@admin.register(Match)
class MatchAdmin(admin.ModelAdmin):
prepopulated_fields = {"fixture": ("team_1", "team_2")}
Currently he puts Team1-Team2, but I need the format to be Team1 vs Team2, it automatically has to be as follows:
That is, the field fixture
is autocomplete with the concatenation of the chains team_1
+ vs + team_2
, so that for example, team_1
is Brazil and team_2
is Argentina, fixture
is autocomplete as Brasil vs Argentina
.
Is there any way to get it? How could I do it?