How to manipulate right hand side of FilteredSelectMultiplein django admin area.
OR
Is there any way to populate right hand side of FilteredSelectMultiplein django admin area.
如何操作FilteredSelectMultiplein django管理区域的右手边。或者有办法填充FilteredSelectMultiplein django管理区域的右侧。
In my scenario I want to order elements on right hand side.
在我的场景中,我想在右边对元素排序。
Djano Model:
Djano模型:
class Elements(models.Model):
movements_rel = models.ManyToOneRel('Movements','elements_rel');
number = models.CharField(max_length=45)
description = models.CharField(max_length=100)
class Movements(models.Model):
sanskrit_name = models.CharField(max_length=45)
english_name = models.CharField(max_length=45)
elements_rel = models.ManyToManyField('Elements',blank=True,through='Movements_Elements_Rel',verbose_name='Select Elements')
class Movements_Elements_Rel(models.Model):
order = models.IntegerField()
elements = models.ForeignKey('Elements')
movements = models.ForeignKey('Movements')
can I show Elements in FilteredSelectMultiple widget with right hand side maintaining particular order
我可以在FilteredSelectMultiple小部件中显示元素吗
1 个解决方案
#1
1
Add
添加
Class Meta:
ordering = ('order',)
to Movements_Elements_Rel and the elements will appear with the particular order.
对于Movements_Elements_Rel,元素将以特定的顺序出现。
Another option is to use AdminInline in the admin to manage the manytomany relationship and use this snippet or django-grappelli. Both of them allow you to use drag-and-drop to set the particular order
另一个选项是在admin中使用AdminInline来管理manytomany关系,并使用这个代码片段或django-grappelli。两者都允许您使用拖放来设置特定的顺序
#1
1
Add
添加
Class Meta:
ordering = ('order',)
to Movements_Elements_Rel and the elements will appear with the particular order.
对于Movements_Elements_Rel,元素将以特定的顺序出现。
Another option is to use AdminInline in the admin to manage the manytomany relationship and use this snippet or django-grappelli. Both of them allow you to use drag-and-drop to set the particular order
另一个选项是在admin中使用AdminInline来管理manytomany关系,并使用这个代码片段或django-grappelli。两者都允许您使用拖放来设置特定的顺序