Thursday, November 26, 2015

formfield_for_foreignkey difficulty

I have formfield_for_foreignkey working for a couple of fields in my
substance model but find a brick wall when I try to restrict choices in
an inline m2m foreign key.

The m2m relation is substance<-m2m->substance where any substance can be
an ingredient in a mixture (also a substance).

The through table is ...

class Substance_Ingredients(models.Model):
substance = models.ForeignKey('Substance', null=True, blank=True,
related_name='base_substance')
ingredient = models.ForeignKey('Substance', null=True, blank=True,)
proportion = models.DecimalField(null=True, blank=True,)

Is that a limitation in the admin or should I try harder?

Thanks

Mike

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5656F9F5.3010306%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment