Django admin site populated combo box based on imput
- by user292652
hi i have to following model
class Match(models.Model):
Team_one = models.ForeignKey('Team', related_name='Team_one')
Team_two = models.ForeignKey('Team', related_name='Team_two')
Stadium = models.CharField(max_length=255, blank=True)
Start_time = models.DateTimeField(auto_now_add=False, auto_now=False, blank=True, null=True)
Rafree = models.CharField(max_length=255, blank=True)
Judge = models.CharField(max_length=255, blank=True)
Winner = models.ForeignKey('Team', related_name='winner', blank=True)
updated = models.DateTimeField('update date', auto_now=True )
created = models.DateTimeField('creation date', auto_now_add=True )
def save(self, force_insert=False, force_update=False):
pass
@models.permalink
def get_absolute_url(self):
return ('view_or_url_name')
class MatchAdmin(admin.ModelAdmin):
list_display = ('Team_one','Team_two', 'Winner')
search_fields = ['Team_one','Team_tow']
admin.site.register(Match, MatchAdmin)
i was wondering is their a way to populated the winner combo box once the team one and team two is selected in admin site ?