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?
You can order the fields as you wish using the ModelAdmin. fields option. The order of fields would depend on the order in which you declare them in your models. So alternatively you could order the fields in the way you would want them to show in the admin.
The admin interface is also customizable in many ways. This post is going to focus on one such customization, something called inlines. When two Django models share a foreign key relation, inlines can be used to expose the related model on the parent model page. This can be extremely useful for many applications.
One of the most powerful parts of Django is the automatic admin interface. It reads metadata from your models to provide a quick, model-centric interface where trusted users can manage content on your site. The admin's recommended use is limited to an organization's internal management tool.
To login to the site, open the /admin URL (e.g. http://127.0.0.1:8000/admin ) and enter your new superuser userid and password credentials (you'll be redirected to the login page, and then back to the /admin URL after you've entered your details).
You can use fields
inside an InlineModelAdmin
:
class FooInline(admin.StackedInline):
model = Foo
fields = ('field1', 'field2', 'field3')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With