Monday, August 27, 2012

Dynamic choices on inlines

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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/X-fIV1Wa_6EJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment