Вопрос

I can't seem to get the sortable inlines feature (in grappelli) work for me.

I'm starting to wonder if the feature is not supported for ManyToManyFields or if I am not getting it right.

Also, is there a sample code out there so I can see and learn? I already followed the method described here.

Это было полезно?

Решение

M2M Fields didn't work for me. But, turns out there's a work-around for this.

I created a through model for a ManyToManyField and added order in that through model. Remember, the through model uses ForeignKey fields. So, the case essentially becomes that of managing a couple of one-to-many relationships.

Implementing sortable inlines is now as easy as following Grappelli's documentation.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top