Hi,

I think you have a misconception in your model. What you need is a many to 
many relation so it does not matter how many metabolites each Reaction has. 
I am not so fimilar with Chemistry. So each stoichiometry belongs to 
exactly one metabolite?

if yes you could create an additional Model call it for example 
StoichiometryMetabolite which has three fields:

stoichiometry = models.CharField(max_length=255, blank=True, null=True)
metabolite = models.ForeignKey('Metabolites', on_delete=models.CASCADE)

reaction = models.ForeignKey('Reactionsmeta', on_delete=models.CASCADE


In your admin.py you have to create an InlineAdmin for 
StoichiometryMetabolite:

class StoichiometryMetaboliteInline(admin.StackedInline):
model = StoichiometryMetabolite
extra = 6

Than you have to add it to your inlines in your Reactionsmeta admin

 inlines = [StoichiometryMetaboliteInline

Everytime you have numbered columns in your model you should consider 
refactor it since it is not good database design.





-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/463d4bef-6105-4175-94ab-afb23b79e313%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to