I have a custom form to display goals. Goals are edited inline in a Game.
class GoalForm(forms.ModelForm):
class Meta:
model = Goal
def __init__(self, *args, **kwargs):
super(GoalForm, self).__init__(*args, **kwargs)
self.fields['goal_scorer'].queryset =
Player.objects.filter(gameroster__game=self.instance.game)
class GoalInline(admin.TabularInline):
model = Goal
extra = 4
#form = GoalForm
class GameAdmin(admin.ModelAdmin):
list_display = ('date_time', 'home_team', 'opponent_team',
'is_home_game', 'result')
list_filter = ['league', 'season']
inlines = [GameRosterInline, GoalInline, PenaltyInline]
ordering = ('date_time',)
My custom form is working as long as I edit it "standalone". As soon as I edit it inline, the custom form is going to be ignored. Commenting in the parameter form of the class GoalInline causes Django to crash.
Any idea how to use the custom form inline?