inlineformset_factory with multiple foreignKeys

90 views
Skip to first unread message

jupiter

unread,
Oct 13, 2015, 6:36:18 PM10/13/15
to django...@googlegroups.com
Hi,

How can the inlineformset_factory be used for multiple following foreignKeys at following an example?

class Recipe(models.Model):
    pub_date = models.DateTimeField('Date Published', auto_now_add = True)
    title = models.CharField(max_length=200)
    instructions = models.TextField()

class Ingredients(models.Model):
    pub_date = models.DateTimeField('Date Published', auto_now_add = True)
    title = models.CharField(max_length=200)
    instructions = models.TextField()

class RecipeIngredient(models.Model):
    recipe = models.ForeignKey(Recipe)
    ingredient = models.ForeignKey(Ingredients)


ingredientFormSet = inlineformset_factory(Recipe, Ingredients, RecipeIngredient) doesn't seem work.

Thank you.

- jup

Nkansah Rexford

unread,
Oct 13, 2015, 7:53:18 PM10/13/15
to Django users
With multiple inlineformset_factory, Ive not tried, but perhaps this could help: http://stackoverflow.com/questions/3945435/adding-multiple-models-to-inlineformset-factory

Mine was just one inlineform

jupiter

unread,
Oct 14, 2015, 4:05:00 AM10/14/15
to django...@googlegroups.com
No longer need it, please ignore it.
Reply all
Reply to author
Forward
0 new messages