Skip to content
Advertisement

django – inlineformset_factory with more than one ForeignKey

I’m trying to do a formset with the following models (boost is the primary):

JavaScript

I want to display a form to add a Boost item, trying to do in this way :

JavaScript

Here are my questions :

1 – When rendered, the combo box for “Creator” shows a list of “db.userInfo” (literally)! I want this to display db.userInfo.auth.username that is already in the database… how to do this?

2 – In this way, where is my “db.gameInfo” to choose?

thank you! =D

======

czarchaic answered my question very well! But now I need just a little question:

When I use the modelform to create a form for the boost_trophy model :

JavaScript

It works nice, but I want the form to show in the “game” box only a really small set of items, only the: gameTrophyInfo(game__name=”Game_A”) results. How can I do this?

Advertisement

Answer

If I understand you correctly:

To change what is displayed set the model’s __unicode__ function

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement