django-nested-admin icon indicating copy to clipboard operation
django-nested-admin copied to clipboard

How to hide ManyToManyField instance name

Open autoantwort opened this issue 4 years ago • 0 comments

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

autoantwort avatar Nov 05 '21 19:11 autoantwort