Django admin site populated combo box based on imput
Posted
by user292652
on Stack Overflow
See other posts from Stack Overflow
or by user292652
Published on 2010-03-13T04:30:20Z
Indexed on
2010/03/13
4:37 UTC
Read the original article
Hit count: 759
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 ?
© Stack Overflow or respective owner