theatlantic / django-nested-admin

Django admin classes that allow for nested inlines
http://django-nested-admin.readthedocs.org/
Other
715 stars 99 forks source link

How to hide ManyToManyField instance name #203

Open autoantwort opened 2 years ago

autoantwort commented 2 years ago

I have the following models:

class Game(models.Model):
    name = models.CharField(max_length=256)
    def __str__(self):
        return self.name

class Category(models.Model):
    name = models.CharField(max_length=100)
    games = models.ManyToManyField(Game)
    def __str__(self):
        return self.name

and the following admin code:

...

class GameInline(nested_admin.nested.NestedTabularInline):
    model = Category.games.through
    autocomplete_fields = ('game',)
    can_delete = False
    verbose_name = "Game"
    extra = 0  # Otherwise 3 empty relations are shows

@admin.register(Category)
class CategoryAdmin(NestedModelAdmin):
    inlines = [GameInline]
    search_fields = ("name",)
    fields = ("name",)

Is it possible to remove the text in the red box?

image