I have a ManyToMany relationship setup with intermediary objects in Django. Any ideas how I can order the < select >s in the Inlines that show up for the intermediary objects?
+1
A:
You can use fields
inside an InlineModelAdmin
:
class FooInline(admin.StackedInline):
model = Foo
fields = ('field1', 'field2', 'field3')
Arnaud
2009-05-28 17:10:59
Sorry, but I wanted to order the elements that show up under a FK relationship in the intermediary object. The word < select > was eaten up by SO.
Yuvi
2009-05-28 17:39:18
A:
Have you tried specifying a model for the many-to-many relationship using the through
argument? You should be able to customize the admin with a ModelAdmin
class then.
class A(models.Model):
pass
class B(models.Model):
m2m = models.ManyToManyField(A, through='C')
class C(models.Model):
a = models.ForeignKey(A)
b = models.ForeignKey(B)
Arnaud
2009-05-28 19:31:53