Dynamic choices on inlines

34 views
Skip to first unread message

Mariano DAngelo

unread,
Aug 27, 2012, 9:46:10 AM8/27/12
to django...@googlegroups.com
Hi, I'm new in django and I'm searching how to the following...

I've the following models

class Fighter(Person):
    pass

class Fight_Event(models.Model):
    pass

# INLINE MODEL

class Fight(models.Model):
    event = models.ForeignKey(Fight_Event)
    fighter1 = models.ForeignKey(Fighter,related_name='fighter1')
    fighter2 = models.ForeignKey(Fighter,related_name='fighter2')     
    winner = # choices fighter1 or fighter2


class Fight_Event_Fight_Inline(admin.TabularInline):
    model = Fight
    fk_name = 'event'

class Fight_Event_ADMIN (ForeignKeyAutocompleteAdmin):
    inlines = [Fight_Event_Fight_Inline,]
    
admin.site.register(Fight_Event,Fight_Event_ADMIN)



I need to add the 2 figther selected on the admin the a third widget to select the winner.... 
I need to load with javascript, or there another way?

Thanks
Reply all
Reply to author
Forward
0 new messages