[Answered ]-Django one-to-many, add fields dynamically in Admin

2👍

Well, it’s the other way around 🙂

1/ Place the foreign key field in your Variant, not in your Product (what you describe is actually a OneToMany relationship).

2/ Link the Variant to your Product in the relative ProductAdmin in admin.py as an inline (i.e VariantInline).

See the docs for further informations : https://docs.djangoproject.com/en/1.6/ref/contrib/admin/#inlinemodeladmin-objects

Hope this helps !

Regards,

Leave a comment