Rename many-to-many label in admin interface
Here's how you can change the label for a tabular inline in the Django admin interface, which shows a many-to-many relationship. Let's say you have a relationship between products and accounts:
class Product(models.Model):
...
accounts = models.ManyToManyField(Account)
To give this relationship a custom label when defining the admin interface:
class ProductsInline(admin.TabularInline):
model = Product.accounts.through
model._meta.verbose_name_plural = "Custom name here"
class AccountAdmin(admin.ModelAdmin):
inlines = [ProductsInline]
Written by Lorin Hochstein
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Related Tags
#django
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#