문제

I'm trying to replicate the inlines in the Django admin for adding related models on a FKd model on my own non admin ModelForm. In particular, when you use a StackeAdminInline and you get the "+ Add another XXX" bit of Javascript to add more of the related model.

It must be possible if the admin can do it, but I can't find a project with an example of how to do this. Can anyone point me at something? Am using Crispy Forms, although happy not to if need be. I did see https://github.com/runekaagaard/django-crispy-forms-fancy-formsets but seems as though this wasn't preferred by the Crispy maintainers, and was thinking there must be some more Djangoic way of doing this if the admin can do it already.

Thanks!

도움이 되었습니까?

해결책

The JS used by the admin is based on this jQuery plugin http://code.google.com/p/django-dynamic-formset/ which is still reasonably maintained.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top